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
Modifier and TypeMethodDescriptiongetCollectionGetterName(String property) Deprecated.MapStruct will not call this method anymore.getElementName(ExecutableElement adderMethod) Returns the element name of the given adder method.getMethodType(ExecutableElement method) Returns the type of the given method.getPropertyName(ExecutableElement getterOrSetterMethod) Returns the name of the property represented by the given getter or setter method.default voidinit(MapStructProcessingEnvironment processingEnvironment) Initializes the accessor naming strategy with the MapStruct processing environment.
-
Method Details
-
init
Initializes the accessor naming strategy with the MapStruct processing environment.- Parameters:
processingEnvironment- environment for facilities- Since:
- 1.3
-
getMethodType
Returns the type of the given method.- Parameters:
method- to be analyzed.- Returns:
- the method type.
-
getPropertyName
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
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.MapStruct 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
-