Interface Method
-
- All Known Implementing Classes:
AbstractToXmlGregorianCalendar
,BuiltInMethod
,CalendarToXmlGregorianCalendar
,CalendarToZonedDateTime
,CreateDecimalFormat
,DateToXmlGregorianCalendar
,ForgedMethod
,HelperMethod
,JodaDateTimeToXmlGregorianCalendar
,JodaLocalDateTimeToXmlGregorianCalendar
,JodaLocalDateToXmlGregorianCalendar
,JodaLocalTimeToXmlGregorianCalendar
,LocalDateTimeToXmlGregorianCalendar
,LocalDateToXmlGregorianCalendar
,SourceMethod
,StringToXmlGregorianCalendar
,XmlGregorianCalendarToCalendar
,XmlGregorianCalendarToDate
,XmlGregorianCalendarToJodaDateTime
,XmlGregorianCalendarToJodaLocalDate
,XmlGregorianCalendarToJodaLocalDateTime
,XmlGregorianCalendarToJodaLocalTime
,XmlGregorianCalendarToLocalDate
,XmlGregorianCalendarToLocalDateTime
,XmlGregorianCalendarToString
,ZonedDateTimeToCalendar
,ZonedDateTimeToXmlGregorianCalendar
public interface Method
This interface makes available common method properties and a matching method There are 2 known implementors:BuiltInMethod
andSourceMethod
- Author:
- Sjaak Derksen
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description String
describe()
Accessibility
getAccessibility()
Returns theAccessibility
of this method.List<Parameter>
getContextParameters()
returns the list of mapping context parameters, i.e. those parameters that are annotated withContext
.ParameterProvidedMethods
getContextProvidedMethods()
Type
getDeclaringMapper()
Returns the mapper type declaring this method if it is not declared by the mapper interface currently processed but by another mapper imported viaMapper#users()
.Type
getDefiningType()
ExecutableElement
getExecutable()
default Type
getMappingSourceType()
Parameter
getMappingTargetParameter()
Returns the parameter designated as mapping target (if present)MappingTarget
String
getName()
Returns then name of the method.MappingMethodOptions
getOptions()
List<String>
getParameterNames()
List<Parameter>
getParameters()
In contrast togetSourceParameters()
this method returns all parametersType
getResultType()
Returns the type of the result.Type
getReturnType()
Returns the return type of the methodList<Parameter>
getSourceParameters()
returns the list of 'true' source parameters excluding the parameter(s) that are designated as target, target type or context parameter.Parameter
getTargetTypeParameter()
Returns the parameter designated as target type (if present)TargetType
List<Type>
getThrownTypes()
Returns all exceptions thrown by this methodList<Type>
getTypeParameters()
Returns the formal type parameters of this method in declaration order.boolean
isDefault()
Whether this method is Java 8 default methodboolean
isLifecycleCallbackMethod()
default boolean
isMappingTargetAssignableToReturnType()
boolean
isObjectFactory()
Returns whether the meethod is designated as bean factory for mapping targetObjectFactory
default boolean
isPresenceCheck()
Returns whether the method is designated as a presence check methodboolean
isStatic()
Whether this method is static or an instance methodboolean
isUpdateMethod()
boolean
matches(List<Type> sourceTypes, Type targetType)
Checks whether the provided sourceType and provided targetType match with the parameter respectively return type of the method.boolean
overridesMethod()
Whether this method overrides an abstract method.
-
-
-
Method Detail
-
matches
boolean matches(List<Type> sourceTypes, Type targetType)
Checks whether the provided sourceType and provided targetType match with the parameter respectively return type of the method. The check also should incorporate wild card and generic type variables- Parameters:
sourceTypes
- the sourceTypes to match to the parametertargetType
- the targetType to match to the returnType- Returns:
- true when match
-
getDeclaringMapper
Type getDeclaringMapper()
Returns the mapper type declaring this method if it is not declared by the mapper interface currently processed but by another mapper imported viaMapper#users()
.- Returns:
- The declaring mapper type
-
getName
String getName()
Returns then name of the method.- Returns:
- method name
-
getParameters
List<Parameter> getParameters()
In contrast togetSourceParameters()
this method returns all parameters- Returns:
- all parameters
-
getSourceParameters
List<Parameter> getSourceParameters()
returns the list of 'true' source parameters excluding the parameter(s) that are designated as target, target type or context parameter.- Returns:
- list of 'true' source parameters
-
getContextParameters
List<Parameter> getContextParameters()
returns the list of mapping context parameters, i.e. those parameters that are annotated withContext
.- Returns:
- list of context parameters
-
getContextProvidedMethods
ParameterProvidedMethods getContextProvidedMethods()
- Returns:
- a mapping between
getContextParameters()
to factory and lifecycle methods provided by them.
-
getMappingTargetParameter
Parameter getMappingTargetParameter()
Returns the parameter designated as mapping target (if present)MappingTarget
- Returns:
- mapping target parameter (when present) null otherwise.
-
isObjectFactory
boolean isObjectFactory()
Returns whether the meethod is designated as bean factory for mapping targetObjectFactory
- Returns:
- true if it is a target bean factory.
-
isPresenceCheck
default boolean isPresenceCheck()
Returns whether the method is designated as a presence check method- Returns:
true
if it is a presence check method
-
getTargetTypeParameter
Parameter getTargetTypeParameter()
Returns the parameter designated as target type (if present)TargetType
- Returns:
- target type parameter (when present) null otherwise.
-
getAccessibility
Accessibility getAccessibility()
Returns theAccessibility
of this method.- Returns:
- the
Accessibility
of this method
-
getReturnType
Type getReturnType()
Returns the return type of the method- Returns:
- return type
-
getThrownTypes
List<Type> getThrownTypes()
Returns all exceptions thrown by this method- Returns:
- exceptions thrown
-
getResultType
Type getResultType()
Returns the type of the result. The result is defined as the type of the parameter designated withMappingTarget
, or in absence the return type.- Returns:
- result type
-
getParameterNames
List<String> getParameterNames()
- Returns:
- the names of the parameters of this mapping method
-
overridesMethod
boolean overridesMethod()
Whether this method overrides an abstract method.- Returns:
- true when an abstract method is overridden.
-
getExecutable
ExecutableElement getExecutable()
-
isStatic
boolean isStatic()
Whether this method is static or an instance method- Returns:
- true when static.
-
isDefault
boolean isDefault()
Whether this method is Java 8 default method- Returns:
- true when Java 8 default method
-
getDefiningType
Type getDefiningType()
- Returns:
- the Type (class or interface) that defines this method.
-
isLifecycleCallbackMethod
boolean isLifecycleCallbackMethod()
- Returns:
true
, if the method represents a mapping lifecycle callback (Before/After mapping method)
-
isUpdateMethod
boolean isUpdateMethod()
- Returns:
true
, if the method is an update method, i.e. it has a parameter annotated with@MappingTarget
.
-
getOptions
MappingMethodOptions getOptions()
- Returns:
- the mapping options for this method
-
isMappingTargetAssignableToReturnType
default boolean isMappingTargetAssignableToReturnType()
- Returns:
- true when @MappingTarget annotated parameter is the same type as the return type. The method has to be an update method in order for this to be true.
-
getMappingSourceType
default Type getMappingSourceType()
- Returns:
- the first source type, intended for mapping methods from single source to target
-
describe
String describe()
- Returns:
- the short name for error messages when verbose, full name when not
-
-