Top Description Constructors Methods
com.fasterxml.jackson.databind.util

public Class BeanUtil

extends Object
Class Inheritance
Imports
java.util.Calendar, .Date, .GregorianCalendar, com.fasterxml.jackson.annotation.JsonInclude, com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.introspect.AnnotatedMethod

Helper class that contains functionality needed by both serialization and deserialization side.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
checkUnsupportedType(JavaType type)

Helper method called by com.fasterxml.jackson.databind.deser.BeanDeserializerFactory and com.fasterxml.jackson.databind.ser.BeanSerializerFactory to check if given unrecognized type (to be (de)serialized as general POJO) is one of "well-known" types for which there would be a datatype module; and if so, return appropriate failure message to give to caller.

public static Object
getDefaultValue(JavaType type)

Accessor used to find out "default value" to use for comparing values to serialize, to determine whether to exclude value from serialization with inclusion type of com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT.

protected static boolean
isCglibGetCallbacks(AnnotatedMethod am)

This method was added to address the need to weed out CGLib-injected "getCallbacks" method.

protected static boolean
isGroovyMetaClassGetter(AnnotatedMethod am)

Another helper method to deal with Groovy's problematic metadata accessors

public static boolean
private static boolean
public static boolean
isJava8TimeClass(Class<?> rawType)

private static boolean
public static boolean
isJodaTimeClass(Class<?> rawType)

private static boolean
protected static String
legacyManglePropertyName(final String
Name of accessor/mutator method, not including prefix ("get"/"is"/"set")
basename
,
final int offset)

Method called to figure out name of the property, given corresponding suggested name based on a method or field name.

public static String
public static String
okNameForIsGetter(AnnotatedMethod am, String name, boolean stdNaming)

public static String
okNameForMutator(AnnotatedMethod am, String prefix, boolean stdNaming)

public static String
public static String
okNameForSetter(AnnotatedMethod am, boolean stdNaming)
Deprecated

public static String
stdManglePropertyName(final String basename, final int offset)

Note

public only since 2.11

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BeanUtilback to summary
public BeanUtil()

Method Detail

checkUnsupportedTypeback to summary
public static String checkUnsupportedType(JavaType type)

Helper method called by com.fasterxml.jackson.databind.deser.BeanDeserializerFactory and com.fasterxml.jackson.databind.ser.BeanSerializerFactory to check if given unrecognized type (to be (de)serialized as general POJO) is one of "well-known" types for which there would be a datatype module; and if so, return appropriate failure message to give to caller.

Since
2.12
getDefaultValueback to summary
public static Object getDefaultValue(JavaType type)

Accessor used to find out "default value" to use for comparing values to serialize, to determine whether to exclude value from serialization with inclusion type of com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT.

Default logic is such that for primitives and wrapper types for primitives, expected defaults (0 for `int` and `java.lang.Integer`) are returned; for Strings, empty String, and for structured (Maps, Collections, arrays) and reference types, criteria com.fasterxml.jackson.annotation.JsonInclude.Include#NON_DEFAULT is used.

Since
2.7
isCglibGetCallbacksback to summary
protected static boolean isCglibGetCallbacks(AnnotatedMethod am)

This method was added to address the need to weed out CGLib-injected "getCallbacks" method. At this point caller has detected a potential getter method with name "getCallbacks" and we need to determine if it is indeed injectect by Cglib. We do this by verifying that the result type is "net.sf.cglib.proxy.Callback[]"

isGroovyMetaClassGetterback to summary
protected static boolean isGroovyMetaClassGetter(AnnotatedMethod am)

Another helper method to deal with Groovy's problematic metadata accessors

isJava8OptionalClassback to summary
public static boolean isJava8OptionalClass(Class<?> rawType)
Since
2.16
isJava8OptionalClassback to summary
private static boolean isJava8OptionalClass(String className)
isJava8TimeClassback to summary
public static boolean isJava8TimeClass(Class<?> rawType)
Since
2.12
isJava8TimeClassback to summary
private static boolean isJava8TimeClass(String className)
isJodaTimeClassback to summary
public static boolean isJodaTimeClass(Class<?> rawType)
Since
2.12
isJodaTimeClassback to summary
private static boolean isJodaTimeClass(String className)
legacyManglePropertyNameback to summary
protected static String legacyManglePropertyName(final String basename, final int offset)

Method called to figure out name of the property, given corresponding suggested name based on a method or field name.

Parameters
basename:String

Name of accessor/mutator method, not including prefix ("get"/"is"/"set")

okNameForGetterback to summary
public static String okNameForGetter(AnnotatedMethod am, boolean stdNaming)
Annotations
@Deprecated
Since
2.5
okNameForIsGetterback to summary
public static String okNameForIsGetter(AnnotatedMethod am, String name, boolean stdNaming)
Annotations
@Deprecated
Since
2.5
okNameForMutatorback to summary
public static String okNameForMutator(AnnotatedMethod am, String prefix, boolean stdNaming)
Annotations
@Deprecated
Since
2.5
okNameForRegularGetterback to summary
public static String okNameForRegularGetter(AnnotatedMethod am, String name, boolean stdNaming)
Annotations
@Deprecated
Since
2.5
okNameForSetterback to summary
public static String okNameForSetter(AnnotatedMethod am, boolean stdNaming)

Deprecated

Annotations
@Deprecated
stdManglePropertyNameback to summary
public static String stdManglePropertyName(final String basename, final int offset)

Note

public only since 2.11

Since
2.5