Class BasicBeanDescription


  • public class BasicBeanDescription
    extends BeanDescription
    Default BeanDescription implementation used by Jackson.

    Although sub-classing is a theoretical possibility there are no known use cases for that, nor is such usage tested or supported. Separation from API is mostly to isolate some implementation details here and keep API simple.

    • Method Detail

      • forOtherUse

        public static BasicBeanDescription forOtherUse​(MapperConfig<?> config,
                                                       JavaType type,
                                                       AnnotatedClass ac)
        Factory method to use for constructing an instance to use for purposes other than building serializers or deserializers; will only have information on class, not on properties.
      • removeProperty

        public boolean removeProperty​(java.lang.String propName)
        Method that can be used to prune unwanted properties, during construction of serializers and deserializers. Use with utmost care, if at all...
        Since:
        2.1
      • hasProperty

        public boolean hasProperty​(PropertyName name)
        Since:
        2.6
      • findJsonKeyAccessor

        public AnnotatedMember findJsonKeyAccessor()
        Description copied from class: BeanDescription
        Method for locating accessor (readable field, or "getter" method) that has JsonKey annotation, if any. If multiple ones are found, an error is reported by throwing IllegalArgumentException
        Overrides:
        findJsonKeyAccessor in class BeanDescription
      • hasKnownClassAnnotations

        public boolean hasKnownClassAnnotations()
        Description copied from class: BeanDescription
        Method for checking whether class being described has any annotations recognized by registered annotation introspector.
        Specified by:
        hasKnownClassAnnotations in class BeanDescription
      • bindingsForBeanType

        @Deprecated
        public TypeBindings bindingsForBeanType()
        Deprecated.
        Description copied from class: BeanDescription
        Accessor for type bindings that may be needed to fully resolve types of member object, such as return and argument types of methods and constructors, and types of fields.
        Specified by:
        bindingsForBeanType in class BeanDescription
      • resolveType

        @Deprecated
        public JavaType resolveType​(java.lang.reflect.Type jdkType)
        Deprecated.
        Description copied from class: BeanDescription
        Method for resolving given JDK type, using this bean as the generic type resolution context.
        Specified by:
        resolveType in class BeanDescription
      • findAnySetterAccessor

        public AnnotatedMember findAnySetterAccessor()
                                              throws java.lang.IllegalArgumentException
        Description copied from class: BeanDescription
        Method used to locate a mutator (settable field, or 2-argument set method) of introspected class that implements JsonAnySetter. If no such mutator exists null is returned. If more than one are found, an exception is thrown. Additional checks are also made to see that method signature is acceptable: needs to take 2 arguments, first one String or Object; second any can be any type.
        Specified by:
        findAnySetterAccessor in class BeanDescription
        Throws:
        java.lang.IllegalArgumentException
      • instantiateBean

        public java.lang.Object instantiateBean​(boolean fixAccess)
        Description copied from class: BeanDescription
        Method called to create a "default instance" of the bean, currently only needed for obtaining default field values which may be used for suppressing serialization of fields that have "not changed".
        Specified by:
        instantiateBean in class BeanDescription
        Parameters:
        fixAccess - If true, method is allowed to fix access to the default constructor (to be able to call non-public constructor); if false, has to use constructor as is.
        Returns:
        Instance of class represented by this descriptor, if suitable default constructor was found; null otherwise.
      • findDefaultViews

        public java.lang.Class<?>[] findDefaultViews()
        Description copied from class: BeanDescription
        Method for finding out if the POJO specifies default view(s) to use for properties, considering both per-type annotations and global default settings.
        Specified by:
        findDefaultViews in class BeanDescription
      • findPropertyInclusion

        public JsonInclude.Value findPropertyInclusion​(JsonInclude.Value defValue)
        Method for determining whether null properties should be written out for a Bean of introspected type. This is based on global feature (lowest priority, passed as argument) and per-class annotation (highest priority).
        Specified by:
        findPropertyInclusion in class BeanDescription
      • findAnyGetter

        public AnnotatedMember findAnyGetter()
                                      throws java.lang.IllegalArgumentException
        Method used to locate the method of introspected class that implements JsonAnyGetter. If no such method exists null is returned. If more than one are found, an exception is thrown.
        Specified by:
        findAnyGetter in class BeanDescription
        Throws:
        java.lang.IllegalArgumentException
      • getFactoryMethods

        public java.util.List<AnnotatedMethod> getFactoryMethods()
        Description copied from class: BeanDescription
        Helper method that will check all static methods of the bean class that seem like factory methods eligible to be used as Creators. This requires that the static method:
        1. Returns type compatible with bean type (same or subtype)
        2. Is recognized from either explicit annotation (usually @JsonCreator OR naming: names valueOf() and fromString() are recognized but only for 1-argument factory methods, and in case of fromString() argument type must further be either String or CharSequence.
        Note that caller typically applies further checks for things like visibility.
        Specified by:
        getFactoryMethods in class BeanDescription
        Returns:
        List of static methods considered as possible Factory methods
      • findSingleArgConstructor

        @Deprecated
        public java.lang.reflect.Constructor<?> findSingleArgConstructor​(java.lang.Class<?>... argTypes)
        Deprecated.
        Specified by:
        findSingleArgConstructor in class BeanDescription
      • findFactoryMethod

        @Deprecated
        public java.lang.reflect.Method findFactoryMethod​(java.lang.Class<?>... expArgTypes)
        Deprecated.
        Specified by:
        findFactoryMethod in class BeanDescription
      • findPOJOBuilder

        public java.lang.Class<?> findPOJOBuilder()
        Description copied from class: BeanDescription
        Method for checking if the POJO type has annotations to indicate that a builder is to be used for instantiating instances and handling data binding, instead of standard bean deserializer.
        Specified by:
        findPOJOBuilder in class BeanDescription
      • findClassDescription

        public java.lang.String findClassDescription()
        Description copied from class: BeanDescription
        Accessor for possible description for the bean type, used for constructing documentation.
        Overrides:
        findClassDescription in class BeanDescription
      • _findPropertyFields

        @Deprecated
        public java.util.LinkedHashMap<java.lang.String,​AnnotatedField> _findPropertyFields​(java.util.Collection<java.lang.String> ignoredProperties,
                                                                                                  boolean forSerialization)
        Deprecated.
        Since 2.7.2, does not seem to be used?
        Parameters:
        ignoredProperties - (optional) names of properties to ignore; any fields that would be recognized as one of these properties is ignored.
        forSerialization - If true, will collect serializable property fields; if false, deserializable
        Returns:
        Ordered Map with logical property name as key, and matching field as value.