com.fasterxml.jackson.databind.introspect

Class BasicBeanDescription



  • public class BasicBeanDescription
    extends BeanDescription
    Default BeanDescription implementation. Can theoretically be subclassed to customize some aspects of property introspection.
    • Field Detail

      • _classInfo

        protected final AnnotatedClass _classInfo
        Information collected about the class introspected.
      • _bindings

        protected TypeBindings _bindings
        We may need type bindings for the bean type. If so, we'll construct it lazily
      • _objectIdInfo

        protected ObjectIdInfo _objectIdInfo
        Details of Object Id to include, if any
      • _ignoredPropertyNames

        protected Set<String> _ignoredPropertyNames
        Set of properties that can be ignored during deserialization, due to being marked as ignored.
    • 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(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
      • 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

        public TypeBindings bindingsForBeanType()
        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
      • findAnySetter

        public AnnotatedMethod findAnySetter()
                                      throws IllegalArgumentException
        Description copied from class: BeanDescription
        Method used to locate the method of introspected class that implements JsonAnySetter. If no such method 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:
        findAnySetter in class BeanDescription
        Throws:
        IllegalArgumentException
      • instantiateBean

        public 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.
      • findExpectedFormat

        public com.fasterxml.jackson.annotation.JsonFormat.Value findExpectedFormat(com.fasterxml.jackson.annotation.JsonFormat.Value defValue)
        Description copied from class: BeanDescription
        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.
        Specified by:
        findExpectedFormat in class BeanDescription
      • findSerializationInclusion

        public com.fasterxml.jackson.annotation.JsonInclude.Include findSerializationInclusion(com.fasterxml.jackson.annotation.JsonInclude.Include 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:
        findSerializationInclusion in class BeanDescription
      • findSingleArgConstructor

        public Constructor<?> findSingleArgConstructor(Class<?>... argTypes)
        Description copied from class: BeanDescription
        Method that can be called to locate a single-arg constructor that takes specified exact type (will not accept supertype constructors)
        Specified by:
        findSingleArgConstructor in class BeanDescription
        Parameters:
        argTypes - Type(s) of the argument that we are looking for
      • findFactoryMethod

        public Method findFactoryMethod(Class<?>... expArgTypes)
        Description copied from class: BeanDescription
        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.
        Specified by:
        findFactoryMethod in class BeanDescription
        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)
      • findCreatorParameterNames

        public List<PropertyName> findCreatorParameterNames()
        Method for getting ordered list of named Creator properties. Returns an empty list is none found. If multiple Creator methods are defined, order between properties from different methods is undefined; however, properties for each such Creator are ordered properly relative to each other. For the usual case of just a single Creator, named properties are thus properly ordered.
        Since:
        2.4
      • findPOJOBuilder

        public 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
      • _findPropertyFields

        public LinkedHashMap<String,AnnotatedField> _findPropertyFields(Collection<String> ignoredProperties,
                                                               boolean forSerialization)
        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.

Copyright © 2014 FasterXML. All Rights Reserved.