Package org.mapstruct.ap.spi
Interface AccessorNamingStrategy
-
- All Known Implementing Classes:
DefaultAccessorNamingStrategy
,FreeBuilderAccessorNamingStrategy
,ImmutablesAccessorNamingStrategy
public interface AccessorNamingStrategy
A service provider interface for the mapping between method names and properties.- Author:
- Christian Schuster, Gunnar Morling
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description String
getCollectionGetterName(String property)
Deprecated.MapStuct will not call this method anymore.String
getElementName(ExecutableElement adderMethod)
Returns the element name of the given adder method.MethodType
getMethodType(ExecutableElement method)
Returns the type of the given method.String
getPropertyName(ExecutableElement getterOrSetterMethod)
Returns the name of the property represented by the given getter or setter method.default void
init(MapStructProcessingEnvironment processingEnvironment)
Initializes the accessor naming strategy with the MapStruct processing environment.
-
-
-
Method Detail
-
init
default void init(MapStructProcessingEnvironment processingEnvironment)
Initializes the accessor naming strategy with the MapStruct processing environment.- Parameters:
processingEnvironment
- environment for facilities- Since:
- 1.3
-
getMethodType
MethodType getMethodType(ExecutableElement method)
Returns the type of the given method.- Parameters:
method
- to be analyzed.- Returns:
- the method type.
-
getPropertyName
String getPropertyName(ExecutableElement getterOrSetterMethod)
Returns the name of the property represented by the given getter or setter method.The default implementation will e.g. return "name" for
public String getName()
orpublic void setName(String name)
.- Parameters:
getterOrSetterMethod
- to be analyzed.- Returns:
- property name derived from the getterOrSetterMethod
-
getElementName
String getElementName(ExecutableElement adderMethod)
Returns the element name of the given adder method.The default implementation will e.g. return "item" for
public void addItem(String item)
.- Parameters:
adderMethod
- to be getterOrSetterMethod.- Returns:
- getter name for collections
-
getCollectionGetterName
@Deprecated String getCollectionGetterName(String property)
Deprecated.MapStuct will not call this method anymore. UsegetMethodType(ExecutableElement)
to determine theMethodType
. When collections somehow need to be treated special, it should be done ingetMethodType(ExecutableElement)
as well. In the future, this method will be removed.Returns the getter name of the given collection property.The default implementation will e.g. return "getItems" for "items".
- Parameters:
property
- to be getterOrSetterMethod.- Returns:
- getter name for collection properties
-
-