Class XmlElementDeclSelector
- java.lang.Object
-
- org.mapstruct.ap.internal.model.source.selector.XmlElementDeclSelector
-
- All Implemented Interfaces:
MethodSelector
- Direct Known Subclasses:
JakartaXmlElementDeclSelector,JavaxXmlElementDeclSelector
abstract class XmlElementDeclSelector extends java.lang.Object implements MethodSelector
Finds theXmlElementRefannotation on a field (of the mapping result type or its super types) matching the target property name. Then selects those methods with matchingnameandscopeattributes of theXmlElementDeclannotation, if that is present. Matching happens in the following order:- Name and Scope matches
- Scope matches
- Name matches
XmlElementDeclit will be considered as matching.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classXmlElementDeclSelector.XmlElementDeclInfoA class, whose purpose is to combine the use ofXmlElementDeclGemandXmlElementDeclGem.(package private) static classXmlElementDeclSelector.XmlElementRefInfo
-
Constructor Summary
Constructors Constructor Description XmlElementDeclSelector(TypeUtils typeUtils)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private XmlElementDeclSelector.XmlElementRefInfofindXmlElementRef(Type resultType, java.lang.String targetPropertyName)Iterate through resultType and its super types to find a field named targetPropertyName and return information about: what the value of the name property of the XmlElementRef annotation on that field was on which type the field was found<T extends Method>
java.util.List<SelectedMethod<T>>getMatchingMethods(Method mappingMethod, java.util.List<SelectedMethod<T>> methods, java.util.List<Type> sourceTypes, Type mappingTargetType, Type returnType, SelectionCriteria criteria)Selects those methods which match the given types and other criteria(package private) abstract XmlElementDeclSelector.XmlElementDeclInfogetXmlElementDeclInfo(javax.lang.model.element.Element element)(package private) abstract XmlElementDeclSelector.XmlElementRefInfogetXmlElementRefInfo(javax.lang.model.element.Element element)
-
-
-
Field Detail
-
typeUtils
private final TypeUtils typeUtils
-
-
Constructor Detail
-
XmlElementDeclSelector
XmlElementDeclSelector(TypeUtils typeUtils)
-
-
Method Detail
-
getMatchingMethods
public <T extends Method> java.util.List<SelectedMethod<T>> getMatchingMethods(Method mappingMethod, java.util.List<SelectedMethod<T>> methods, java.util.List<Type> sourceTypes, Type mappingTargetType, Type returnType, SelectionCriteria criteria)
Description copied from interface:MethodSelectorSelects those methods which match the given types and other criteria- Specified by:
getMatchingMethodsin interfaceMethodSelector- Type Parameters:
T- either SourceMethod or BuiltInMethod- Parameters:
mappingMethod- mapping method, defined in Mapper for which this selection is carried outmethods- list of available methodssourceTypes- parameter type(s) that should be matchedmappingTargetType- mappingTargetType that should be matchedreturnType- return type that should be matchedcriteria- criteria used in the selection process- Returns:
- list of methods that passes the matching process
-
findXmlElementRef
private XmlElementDeclSelector.XmlElementRefInfo findXmlElementRef(Type resultType, java.lang.String targetPropertyName)
Iterate through resultType and its super types to find a field named targetPropertyName and return information about:- what the value of the name property of the XmlElementRef annotation on that field was
- on which type the field was found
- Parameters:
resultType- starting point of the iterationtargetPropertyName- name of the field we are looking for- Returns:
- an XmlElementRefInfo containing the information
-
getXmlElementDeclInfo
abstract XmlElementDeclSelector.XmlElementDeclInfo getXmlElementDeclInfo(javax.lang.model.element.Element element)
-
getXmlElementRefInfo
abstract XmlElementDeclSelector.XmlElementRefInfo getXmlElementRefInfo(javax.lang.model.element.Element element)
-
-