com.fasterxml.jackson.databind.BeanDescription Maven / Gradle / Ivy
Show all versions of redisson-all Show documentation
package com.fasterxml.jackson.databind;
import java.util.*;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.databind.introspect.*;
import com.fasterxml.jackson.databind.util.Annotations;
import com.fasterxml.jackson.databind.util.Converter;
/**
* Basic container for information gathered by {@link ClassIntrospector} to
* help in constructing serializers and deserializers.
* Note that the one implementation type is
* {@link com.fasterxml.jackson.databind.introspect.BasicBeanDescription},
* meaning that it is safe to upcast to that type.
*/
public abstract class BeanDescription
{
/**
* Bean type information, including raw class and possible
* generics information
*/
protected final JavaType _type;
/*
/**********************************************************
/* Life-cycle
/**********************************************************
*/
protected BeanDescription(JavaType type) {
_type = type;
}
/*
/**********************************************************
/* Simple accessors
/**********************************************************
*/
/**
* Method for accessing declared type of bean being introspected,
* including full generic type information (from declaration)
*/
public JavaType getType() { return _type; }
public Class> getBeanClass() { return _type.getRawClass(); }
/**
* @since 2.15
*/
public boolean isRecordType() { return _type.isRecordType(); }
/**
* @since 2.9
*/
public boolean isNonStaticInnerClass() {
return getClassInfo().isNonStaticInnerClass();
}
/**
* Method for accessing low-level information about Class this
* item describes.
*/
public abstract AnnotatedClass getClassInfo();
/**
* Accessor for getting information about Object Id expected to
* be used for this POJO type, if any.
*/
public abstract ObjectIdInfo getObjectIdInfo();
/**
* Method for checking whether class being described has any
* annotations recognized by registered annotation introspector.
*/
public abstract boolean hasKnownClassAnnotations();
/**
* Method for accessing collection of annotations the bean
* class has.
*/
public abstract Annotations getClassAnnotations();
/*
/**********************************************************
/* Basic API for finding properties
/**********************************************************
*/
/**
* @return Ordered Map with logical property name as key, and
* matching getter method as value.
*/
public abstract List findProperties();
public abstract Set getIgnoredPropertyNames();
/**
* Method for locating all back-reference properties (setters, fields) bean has
*
* @since 2.9
*/
public abstract List findBackReferences();
/*
/**********************************************************
/* Basic API for finding Creators, related information
/**********************************************************
*/
/**
* Helper method that will return all non-default constructors (that is,
* constructors that take one or more arguments) this class has.
*/
public abstract List getConstructors();
/**
* Method similar to {@link #getConstructors()} except will also introspect
* {@code JsonCreator.Mode} and filter out ones marked as not applicable and
* include mode (or lack thereof) for remaining constructors.
*
* Note that no other filtering (regarding visibility or other annotations)
* is performed
*
* @since 2.13
*/
public abstract List> getConstructorsWithMode();
/**
* 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:
*
* - Returns type compatible with bean type (same or subtype)
*
* - Is recognized from either explicit annotation (usually {@code @JsonCreator}
* OR naming:
* names {@code valueOf()} and {@code fromString()} are recognized but
* only for 1-argument factory methods, and in case of {@code fromString()}
* argument type must further be either {@code String} or {@code CharSequence}.
*
*
* Note that caller typically applies further checks for things like visibility.
*
* @return List of static methods considered as possible Factory methods
*/
public abstract List getFactoryMethods();
/**
* Method similar to {@link #getFactoryMethods()} but will return {@code JsonCreator.Mode}
* metadata along with qualifying factory method candidates.
*
* @since 2.13
*/
public abstract List> getFactoryMethodsWithMode();
/**
* Method that will locate the no-arg constructor for this class,
* if it has one, and that constructor has not been marked as
* ignorable.
*/
public abstract AnnotatedConstructor findDefaultConstructor();
/**
* Method that is replacing earlier Creator introspection access methods.
*
* @since 2.18
*
* @return Container for introspected Creator candidates, if any
*/
public abstract PotentialCreators getPotentialCreators();
/*
/**********************************************************
/* Basic API for finding property accessors
/**********************************************************
*/
/**
* Method for locating accessor (readable field, or "getter" method)
* that has
* {@link com.fasterxml.jackson.annotation.JsonKey} annotation,
* if any. If multiple ones are found,
* an error is reported by throwing {@link IllegalArgumentException}
*
* @since 2.12
*/
public AnnotatedMember findJsonKeyAccessor() {
return null;
}
/**
* Method for locating accessor (readable field, or "getter" method)
* that has
* {@link com.fasterxml.jackson.annotation.JsonValue} annotation,
* if any. If multiple ones are found,
* an error is reported by throwing {@link IllegalArgumentException}
*
* @since 2.9
*/
public abstract AnnotatedMember findJsonValueAccessor();
public abstract AnnotatedMember findAnyGetter();
/**
* Method used to locate a mutator (settable field, or 2-argument set method)
* of introspected class that
* implements {@link com.fasterxml.jackson.annotation.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
*/
public abstract AnnotatedMember findAnySetterAccessor();
public abstract AnnotatedMethod findMethod(String name, Class>[] paramTypes);
/*
/**********************************************************
/* Basic API, class configuration
/**********************************************************
*/
/**
* 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
*/
public abstract JsonInclude.Value findPropertyInclusion(JsonInclude.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.17
*/
public abstract JsonFormat.Value findExpectedFormat();
/**
* @since 2.1
* @deprecated Since 2.17 use {@link #findExpectedFormat()}
*/
@Deprecated // since 2.17
public JsonFormat.Value findExpectedFormat(JsonFormat.Value defValue) {
JsonFormat.Value v = findExpectedFormat();
if (defValue == null) {
return v;
}
if (v == null) {
return defValue;
}
return defValue.withOverrides(v);
}
/**
* Method for finding {@link Converter} used for serializing instances
* of this class.
*
* @since 2.2
*/
public abstract Converter