Class BeanDescription

  • Direct Known Subclasses:
    BasicBeanDescription

    public abstract class BeanDescription
    extends java.lang.Object
    Basic container for information gathered by ClassIntrospector to help in constructing serializers and deserializers. Note that the main implementation type is BasicBeanDescription, meaning that it is safe to upcast to this type.
    • Method Detail

      • getType

        public JavaType getType()
        Method for accessing declared type of bean being introspected, including full generic type information (from declaration)
      • getBeanClass

        public java.lang.Class<?> getBeanClass()
      • isNonStaticInnerClass

        public boolean isNonStaticInnerClass()
        Since:
        2.9
      • getClassInfo

        public abstract AnnotatedClass getClassInfo()
        Method for accessing low-level information about Class this item describes.
      • getObjectIdInfo

        public abstract ObjectIdInfo getObjectIdInfo()
        Accessor for getting information about Object Id expected to be used for this POJO type, if any.
      • hasKnownClassAnnotations

        public abstract boolean hasKnownClassAnnotations()
        Method for checking whether class being described has any annotations recognized by registered annotation introspector.
      • bindingsForBeanType

        @Deprecated
        public abstract TypeBindings bindingsForBeanType()
        Deprecated.
        Since 2.7, should not need to access bindings directly
        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.
      • resolveType

        @Deprecated
        public abstract JavaType resolveType​(java.lang.reflect.Type jdkType)
        Deprecated.
        Since 2.8, should simply call getType of property accessor directly.
        Method for resolving given JDK type, using this bean as the generic type resolution context.
      • getClassAnnotations

        public abstract Annotations getClassAnnotations()
        Method for accessing collection of annotations the bean class has.
      • findProperties

        public abstract java.util.List<BeanPropertyDefinition> findProperties()
        Returns:
        Ordered Map with logical property name as key, and matching getter method as value.
      • getIgnoredPropertyNames

        public abstract java.util.Set<java.lang.String> getIgnoredPropertyNames()
      • findBackReferences

        public abstract java.util.List<BeanPropertyDefinition> findBackReferences()
        Method for locating all back-reference properties (setters, fields) bean has
        Since:
        2.9
      • findBackReferenceProperties

        @Deprecated
        public abstract java.util.Map<java.lang.String,​AnnotatedMember> findBackReferenceProperties()
        Deprecated.
        Since 2.9 use findBackReferences() instead
        Method for locating all back-reference properties (setters, fields) bean has
      • getFactoryMethods

        public abstract java.util.List<AnnotatedMethod> getFactoryMethods()
      • findDefaultConstructor

        public abstract AnnotatedConstructor findDefaultConstructor()
        Method that will locate the no-arg constructor for this class, if it has one, and that constructor has not been marked as ignorable.
      • findSingleArgConstructor

        public abstract java.lang.reflect.Constructor<?> findSingleArgConstructor​(java.lang.Class<?>... argTypes)
        Method that can be called to locate a single-arg constructor that takes specified exact type (will not accept supertype constructors)
        Parameters:
        argTypes - Type(s) of the argument that we are looking for
      • findFactoryMethod

        public abstract java.lang.reflect.Method findFactoryMethod​(java.lang.Class<?>... expArgTypes)
        Method that can be called to find if introspected class declares a static "valueOf" factory method that returns an instance of introspected type, given one of acceptable types.
        Parameters:
        expArgTypes - Types that the matching single argument factory method can take: will also accept super types of these types (ie. arg just has to be assignable from expArgType)
      • findJsonValueAccessor

        public abstract AnnotatedMember findJsonValueAccessor()
        Method for locating accessor (readable field, or "getter" method) that has JsonValue annotation, if any. If multiple ones are found, an error is reported by throwing IllegalArgumentException
        Since:
        2.9
      • findAnySetterAccessor

        public abstract AnnotatedMember findAnySetterAccessor()
        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.
        Since:
        2.9
      • findMethod

        public abstract AnnotatedMethod findMethod​(java.lang.String name,
                                                   java.lang.Class<?>[] paramTypes)
      • findJsonValueMethod

        @Deprecated
        public abstract AnnotatedMethod findJsonValueMethod()
        Deprecated.
      • findPropertyInclusion

        public abstract JsonInclude.Value findPropertyInclusion​(JsonInclude.Value defValue)
        Method for finding annotation-indicated inclusion definition (if any); possibly overriding given default value.

        NOTE: does NOT use global inclusion default settings as the base, unless passed as `defValue`.

        Since:
        2.7
      • findExpectedFormat

        public abstract JsonFormat.Value findExpectedFormat​(JsonFormat.Value defValue)
        Method for checking what is the expected format for POJO, as defined by defaults and possible annotations. Note that this may be further refined by per-property annotations.
        Since:
        2.1
      • findSerializationConverter

        public abstract Converter<java.lang.Object,​java.lang.Object> findSerializationConverter()
        Method for finding Converter used for serializing instances of this class.
        Since:
        2.2
      • findDeserializationConverter

        public abstract Converter<java.lang.Object,​java.lang.Object> findDeserializationConverter()
        Method for finding Converter used for serializing instances of this class.
        Since:
        2.2
      • findClassDescription

        public java.lang.String findClassDescription()
        Accessor for possible description for the bean type, used for constructing documentation.
        Since:
        2.7
      • findInjectables

        public abstract java.util.Map<java.lang.Object,​AnnotatedMember> findInjectables()
      • findPOJOBuilder

        public abstract java.lang.Class<?> findPOJOBuilder()
        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.
      • findPOJOBuilderConfig

        public abstract JsonPOJOBuilder.Value findPOJOBuilderConfig()
        Method for finding configuration for POJO Builder class.
      • instantiateBean

        public abstract java.lang.Object instantiateBean​(boolean fixAccess)
        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".
        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 abstract java.lang.Class<?>[] findDefaultViews()
        Method for finding out if the POJO specifies default view(s) to use for properties, considering both per-type annotations and global default settings.
        Since:
        2.9