Class XmlElementDeclSelector

  • All Implemented Interfaces:
    MethodSelector
    Direct Known Subclasses:
    JakartaXmlElementDeclSelector, JavaxXmlElementDeclSelector

    abstract class XmlElementDeclSelector
    extends java.lang.Object
    implements MethodSelector
    Finds the XmlElementRef annotation on a field (of the mapping result type or its super types) matching the target property name. Then selects those methods with matching name and scope attributes of the XmlElementDecl annotation, if that is present. Matching happens in the following order:
    1. Name and Scope matches
    2. Scope matches
    3. Name matches
    If there are name and scope matches, only those will be returned, otherwise the next in line (scope matches), etc. If the given method is not annotated with XmlElementDecl it will be considered as matching.
    See Also:
    JavaxXmlElementDeclSelector, JakartaXmlElementDeclSelector
    • 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: MethodSelector
        Selects those methods which match the given types and other criteria
        Specified by:
        getMatchingMethods in interface MethodSelector
        Type Parameters:
        T - either SourceMethod or BuiltInMethod
        Parameters:
        mappingMethod - mapping method, defined in Mapper for which this selection is carried out
        methods - list of available methods
        sourceTypes - parameter type(s) that should be matched
        mappingTargetType - mappingTargetType that should be matched
        returnType - return type that should be matched
        criteria - 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 iteration
        targetPropertyName - name of the field we are looking for
        Returns:
        an XmlElementRefInfo containing the information