Class JakartaXmlBindAnnotationIntrospector

    • Constructor Detail

      • JakartaXmlBindAnnotationIntrospector

        @Deprecated
        public JakartaXmlBindAnnotationIntrospector()
        Deprecated.
        Since 2.1, use constructor that takes TypeFactory.
      • JakartaXmlBindAnnotationIntrospector

        public JakartaXmlBindAnnotationIntrospector​(MapperConfig<?> config)
      • JakartaXmlBindAnnotationIntrospector

        public JakartaXmlBindAnnotationIntrospector​(TypeFactory typeFactory)
      • JakartaXmlBindAnnotationIntrospector

        public JakartaXmlBindAnnotationIntrospector​(TypeFactory typeFactory,
                                                    boolean ignoreXmlIDREF)
        Parameters:
        typeFactory - Type factory used for resolving type information
        ignoreXmlIDREF - Whether XmlIDREF annotation should be processed JAXB style (meaning that references are always serialized using id), or not (first reference as full POJO, others as ids)
    • Method Detail

      • version

        public Version version()
        Method that will return version information stored in and read from jar that contains this class.
        Specified by:
        version in interface Versioned
        Specified by:
        version in class AnnotationIntrospector
        Returns:
        Version of the component
      • setNameUsedForXmlValue

        public void setNameUsedForXmlValue​(String name)
        Configuration method that can be used to change default name ("value") used for properties annotated with XmlValue; note that setting it to null will actually avoid name override, and name will instead be derived from underlying method name using standard bean name introspection.
      • getNameUsedForXmlValue

        public String getNameUsedForXmlValue()
        Accessor for getting currently configured placeholder named used for property annotated with XmlValue.
      • isOutputAsAttribute

        public Boolean isOutputAsAttribute​(MapperConfig<?> config,
                                           Annotated ann)
        Here we assume fairly simple logic; if there is XmlAttribute to be found, we consider it an attribute; if XmlElement, not-an-attribute; and otherwise we will consider there to be no information. Caller is likely to default to considering things as elements.
        Specified by:
        isOutputAsAttribute in interface AnnotationIntrospector.XmlExtensions
        Parameters:
        config - Configuration settings in effect
        ann - Annotated entity to introspect
        Returns:
        Null if no indicator found; True or False otherwise
      • isOutputAsText

        public Boolean isOutputAsText​(MapperConfig<?> config,
                                      Annotated ann)
        Description copied from interface: AnnotationIntrospector.XmlExtensions
        Method used to check whether given annotated element (field, method, constructor parameter) has indicator that suggests it should be serialized as text, without element wrapper.
        Specified by:
        isOutputAsText in interface AnnotationIntrospector.XmlExtensions
        Parameters:
        config - Configuration settings in effect
        ann - Annotated entity to introspect
        Returns:
        Null if no indicator found; True or False otherwise
      • findObjectIdInfo

        public ObjectIdInfo findObjectIdInfo​(Annotated ann)
        Description copied from class: AnnotationIntrospector
        Method for checking whether given annotated thing (type, or accessor) indicates that values referenced (values of type of annotated class, or values referenced by annotated property; latter having precedence) should include Object Identifier, and if so, specify details of Object Identity used.
        Overrides:
        findObjectIdInfo in class AnnotationIntrospector
        Parameters:
        ann - Annotated entity to introspect
        Returns:
        Details of Object Id as explained above, if Object Id handling to be applied; null otherwise.
      • findRootName

        public PropertyName findRootName​(AnnotatedClass ac)
        Description copied from class: AnnotationIntrospector
        Method for locating name used as "root name" (for use by some serializers when outputting root-level object -- mostly for XML compatibility purposes) for given class, if one is defined. Returns null if no declaration found; can return explicit empty String, which is usually ignored as well as null.

        NOTE: method signature changed in 2.1, to return PropertyName instead of String.

        Overrides:
        findRootName in class AnnotationIntrospector
        Parameters:
        ac - Annotated class to introspect
        Returns:
        Root name to use, if any; null if not
      • isIgnorableType

        public Boolean isIgnorableType​(AnnotatedClass ac)
        Description copied from class: AnnotationIntrospector
        Method for checking whether properties that have specified type (class, not generics aware) should be completely ignored for serialization and deserialization purposes.
        Overrides:
        isIgnorableType in class AnnotationIntrospector
        Parameters:
        ac - Annotated class to introspect
        Returns:
        Boolean.TRUE if properties of type should be ignored; Boolean.FALSE if they are not to be ignored, null for default handling (which is 'do not ignore')
      • hasIgnoreMarker

        public boolean hasIgnoreMarker​(AnnotatedMember m)
        Description copied from class: AnnotationIntrospector
        Method called to check whether given property is marked to be ignored. This is used to determine whether to ignore properties, on per-property basis, usually combining annotations from multiple accessors (getters, setters, fields, constructor parameters).
        Overrides:
        hasIgnoreMarker in class AnnotationIntrospector
      • findWrapperName

        public PropertyName findWrapperName​(Annotated ann)
        Description copied from class: AnnotationIntrospector
        Method used to check if specified property has annotation that indicates that it should be wrapped in an element; and if so, name to use. Note that not all serializers and deserializers support use this method: currently (2.1) it is only used by XML-backed handlers.
        Overrides:
        findWrapperName in class AnnotationIntrospector
        Returns:
        Wrapper name to use, if any, or PropertyName.USE_DEFAULT to indicate that no wrapper element should be used.
      • findImplicitPropertyName

        public String findImplicitPropertyName​(AnnotatedMember m)
        Description copied from class: AnnotationIntrospector
        Method for finding implicit name for a property that given annotated member (field, method, creator parameter) may represent. This is different from explicit, annotation-based property name, in that it is "weak" and does not either proof that a property exists (for example, if visibility is not high enough), or override explicit names. In practice this method is used to introspect optional names for creator parameters (which may or may not be available and cannot be detected by standard databind); or to provide alternate name mangling for fields, getters and/or setters.
        Overrides:
        findImplicitPropertyName in class AnnotationIntrospector
      • findAutoDetectVisibility

        public VisibilityChecker<?> findAutoDetectVisibility​(AnnotatedClass ac,
                                                             VisibilityChecker<?> checker)
        Description copied from class: AnnotationIntrospector
        Method for checking if annotations indicate changes to minimum visibility levels needed for auto-detecting property elements (fields, methods, constructors). A baseline checker is given, and introspector is to either return it as is (if no annotations are found), or build and return a derived instance (using checker's build methods).
        Overrides:
        findAutoDetectVisibility in class AnnotationIntrospector
        Parameters:
        ac - Annotated class to introspect
        checker - Default visibility settings in effect before any override
        Returns:
        Visibility settings after possible annotation-based overrides
      • findAccessType

        protected XmlAccessType findAccessType​(Annotated ac)
        Method for locating JAXB XmlAccessType annotation value for given annotated entity, if it has one, or inherits one from its ancestors (in JAXB sense, package etc). Returns null if nothing has been explicitly defined.
      • findPropertyContentTypeResolver

        public TypeResolverBuilder<?> findPropertyContentTypeResolver​(MapperConfig<?> config,
                                                                      AnnotatedMember am,
                                                                      JavaType containerType)
        Description copied from class: AnnotationIntrospector
        Method for checking if given structured property entity (field or method that has nominal value of Map, Collection or array type) has annotations that indicate that specific type resolver is to be used for handling type information of contained values. This includes not only instantiating resolver builder, but also configuring it based on relevant annotations (not including ones checked with a call to AnnotationIntrospector.findSubtypes(com.fasterxml.jackson.databind.introspect.Annotated)
        Overrides:
        findPropertyContentTypeResolver in class AnnotationIntrospector
        Parameters:
        config - Configuration settings in effect (for serialization or deserialization)
        am - Annotated member (field or method) to check for annotations
        containerType - Type of property for which resolver is to be found (must be a container type)
        Returns:
        Type resolver builder for values contained in properties of given entity, if one found; null if none
      • findSubtypes

        public List<NamedType> findSubtypes​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for locating annotation-specified subtypes related to annotated entity (class, method, field). Note that this is only guaranteed to be a list of directly declared subtypes, no recursive processing is guarantees (i.e. caller has to do it if/as necessary)
        Overrides:
        findSubtypes in class AnnotationIntrospector
        Parameters:
        a - Annotated entity (class, field/method) to check for annotations
        Returns:
        List of subtype definitions found if any; null if none
      • findContentSerializer

        public Object findContentSerializer​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for getting a serializer definition for content (values) of associated Collection, array or Map property. Type of definition is either instance (of type JsonSerializer) or Class (of type Class<JsonSerializer>); if value of different type is returned, a runtime exception may be thrown by caller.
        Overrides:
        findContentSerializer in class AnnotationIntrospector
      • findPropertyInclusion

        public JsonInclude.Value findPropertyInclusion​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for checking inclusion criteria for a type (Class) or property (yes, method name is bit unfortunate -- not just for properties!). In case of class, acts as the default for properties POJO contains; for properties acts as override for class defaults and possible global defaults.
        Overrides:
        findPropertyInclusion in class AnnotationIntrospector
      • findSerializationConverter

        public Object findSerializationConverter​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for finding Converter that annotated entity (property or class) has indicated to be used as part of serialization. If not null, either has to be actual Converter instance, or class for such converter; and resulting converter will be used first to convert property value to converter target type, and then serializer for that type is used for actual serialization.

        This feature is typically used to convert internal values into types that Jackson can convert.

        Note also that this feature does not necessarily work well with polymorphic type handling, or object identity handling; if such features are needed an explicit serializer is usually better way to handle serialization.

        Overrides:
        findSerializationConverter in class AnnotationIntrospector
        Parameters:
        a - Annotated property (field, method) or class to check for annotations
      • findNameForSerialization

        public PropertyName findNameForSerialization​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for serialization. Should return null if no annotation is found; otherwise a non-null name (possibly PropertyName.USE_DEFAULT, which means "use default heuristics").
        Overrides:
        findNameForSerialization in class AnnotationIntrospector
        Parameters:
        a - Property accessor to check
        Returns:
        Name to use if found; null if not.
      • findEnumValues

        public String[] findEnumValues​(Class<?> enumType,
                                       Enum<?>[] enumValues,
                                       String[] names)
        Description copied from class: AnnotationIntrospector
        Method for efficiently figuring out which if given set of Enum values have explicitly defined name. Method will overwrite entries in incoming names array with explicit names found, if any, leaving other entries unmodified.
        Overrides:
        findEnumValues in class AnnotationIntrospector
        Parameters:
        enumType - Type of Enumeration
        enumValues - Values of enumeration
        names - Matching declared names of enumeration values (with indexes matching enumValues entries)
        Returns:
        Array of names to use (possible names passed as argument)
      • findKeyDeserializer

        public Object findKeyDeserializer​(Annotated am)
        Description copied from class: AnnotationIntrospector
        Method for getting a deserializer definition for keys of associated Map property. Type of definition is either instance (of type JsonDeserializer) or Class (of type Class<JsonDeserializer>); if value of different type is returned, a runtime exception may be thrown by caller.
        Overrides:
        findKeyDeserializer in class AnnotationIntrospector
      • findContentDeserializer

        public Object findContentDeserializer​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for getting a deserializer definition for content (values) of associated Collection, array or Map property. Type of definition is either instance (of type JsonDeserializer) or Class (of type Class<JsonDeserializer>); if value of different type is returned, a runtime exception may be thrown by caller.
        Overrides:
        findContentDeserializer in class AnnotationIntrospector
      • _doFindDeserializationType

        protected Class<?> _doFindDeserializationType​(Annotated a,
                                                      JavaType baseType)
      • findNameForDeserialization

        public PropertyName findNameForDeserialization​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for checking whether given property accessors (method, field) has an annotation that suggests property name to use for deserialization (reading JSON into POJOs). Should return null if no annotation is found; otherwise a non-null name (possibly PropertyName.USE_DEFAULT, which means "use default heuristics").
        Overrides:
        findNameForDeserialization in class AnnotationIntrospector
        Parameters:
        a - Annotated entity to check
        Returns:
        Name to use if found; null if not.
      • findDeserializationConverter

        public Object findDeserializationConverter​(Annotated a)
        Description copied from class: AnnotationIntrospector
        Method for finding Converter that annotated entity (property or class) has indicated to be used as part of deserialization. If not null, either has to be actual Converter instance, or class for such converter; and resulting converter will be used after Jackson has deserializer data into intermediate type (Converter input type), and Converter needs to convert this into its target type to be set as property value.

        This feature is typically used to convert intermediate Jackson types (that default deserializers can produce) into custom type instances.

        Note also that this feature does not necessarily work well with polymorphic type handling, or object identity handling; if such features are needed an explicit deserializer is usually better way to handle deserialization.

        Overrides:
        findDeserializationConverter in class AnnotationIntrospector
        Parameters:
        a - Annotated property (field, method) or class to check for annotations
      • isJAXBAnnotation

        protected boolean isJAXBAnnotation​(Annotation ann)
        An annotation is handled if it's in the same package as @XmlElement, including subpackages.
        Parameters:
        ann - The annotation.
        Returns:
        Whether the annotation is in the JAXB package.
      • getTypeFactory

        protected final TypeFactory getTypeFactory()
      • _findContentAdapter

        protected XmlAdapter<?,​?> _findContentAdapter​(Annotated ann,
                                                            boolean forSerialization)
      • _rawDeserializationType

        protected Class<?> _rawDeserializationType​(Annotated a)
      • _rawSerializationType

        protected Class<?> _rawSerializationType​(Annotated a)
      • _getTypeFromXmlElement

        protected Class<?> _getTypeFromXmlElement​(Annotated a)
      • _stdManglePropertyName

        protected String _stdManglePropertyName​(String basename,
                                                int offset)
      • _decapitalize

        protected String _decapitalize​(String name)