| Modifier and Type | Class and Description |
|---|---|
| public static class | ClassUtil.
Value class used for containing information about discovered Constructors |
| private static class | ClassUtil.
Inner class used to contain gory details of how we can determine
details of instances of common JDK types like |
| Modifier and Type | Field and Description |
|---|---|
| private static final Class | |
| private static final Iterator | |
| private static final List | |
| private static final ClassUtil. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | _addRawSuperTypes(Class<?> cls, Class<?> endBefore, Collection<Class<?>> result, boolean addClassItself)
|
| private static Method[] | |
| public static String | |
| public static String | |
| public static String | Returns: Null if class might be a bean; type String (that identifies why it's not a bean) if not
|
| public static void | checkAndFixAccess(Member
Accessor to call member, boolean setAccessible() on.Whether to always try to make accessor
accessible, even if evenIfAlreadyPublic)public (true),
or only if needed to force by-pass of non-public access (false)Method that is called if a |
| public static String | classNameOf(Object inst)
Helper method used to construct appropriate description when passed either type (Class) or an instance; in latter case, class of instance is to be used. |
| public static Class | |
| public static void | closeOnFailAndThrowAsJacksonE(JsonGenerator g, Exception fail)
Helper method that encapsulate logic in trying to close output generator in case of failure; useful mostly in forcing flush()ing as otherwise error conditions tend to be hard to diagnose. |
| public static void | closeOnFailAndThrowAsJacksonE(JsonGenerator g, AutoCloseable toClose, Exception fail)
Helper method that encapsulate logic in trying to close given |
| public static <T> T | createInstance(Class<T> cls, boolean
Whether it is possible to try to change access
rights of the default constructor (in case it is not publicly
accessible) or not. canFixAccess)Method that can be called to try to create an instantiate of specified type. |
| public static Object | defaultValue(Class<?> cls)
Helper method used to get default value for wrappers used for primitive types (0 for Integer etc) |
| public static <T> Iterator | |
| public static <T> Stream | |
| public static String | exceptionMessage(Throwable t)
Helper method that returns |
| public static <T> Constructor | |
| public static Class | findEnumType(EnumSet<?> s)
Helper method that can be used to dynamically figure out
enumeration type of given |
| public static Class | findEnumType(EnumMap<?, ?> m)
Helper method that can be used to dynamically figure out
enumeration type of given |
| public static Class | findEnumType(Enum<?> en)
Helper method that can be used to dynamically figure out formal enumeration type (class) for given enumeration. |
| public static Class | findEnumType(Class<?> cls)
Helper method that can be used to dynamically figure out formal enumeration type (class) for given class of an enumeration value. |
| public static List | |
| public static List | findSuperClasses(Class<?> cls, Class<?> endBefore, boolean addClassItself)
Method for finding all super classes (but not super interfaces) of given class, starting with the immediate super class and ending in the most distant one. |
| public static String | getClassDescription(Object classOrInstance)
Helper method used to construct appropriate description when passed either type (Class) or an instance; in latter case, class of instance is to be used. |
| public static Method[] | getClassMethods(Class<?> cls)
Helper method that gets methods declared in given class; usually a simple thing, but sometimes (as per [databind#785]) more complicated, depending on classloader setup. |
| public static ClassUtil. | |
| public static Class | |
| public static Class | |
| public static int | |
| public static Class | |
| public static Throwable | getRootCause(Throwable t)
Method that can be used to find the "root cause", innermost of chained (wrapped) exceptions. |
| public static String | Returns: String description of type including generic type parameters, surrounded by backticks, if type passed; or string "null" if {code null} passedFully resolved type or null fullType)Helper method to create and return "backticked" description of given
resolved type (or, |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| public static boolean | |
| public static boolean | isConcrete(Class<?> type)
Helper method that checks if given class is a concrete one; that is, not an interface or abstract class. |
| public static boolean | |
| public static boolean | isEnumType(Class<?> rawType)
Helper method that encapsulates reliable check on whether
given raw type "is an Enum", that is, is or extends |
| public static boolean | isJacksonStdImpl(Object impl)
Method that can be called to determine if given Object is the default implementation Jackson uses; as opposed to a custom serializer installed by a module or calling application. |
| public static boolean | |
| public static boolean | Returns: True if we can determine that the code is running on
JDK 17 or above; false otherwise.Convenience method for: return getJDKMajorVersion() >= 17 |
| public static boolean | isJDKClass(Class<?> rawType)
Accessor for checking whether given |
| public static boolean | isJDKCoreClass(Class<?> rawType)
Similar to |
| public static String | |
| public static boolean | |
| public static boolean | |
| public static boolean | isProxyType(Class<?> type)
Helper method used to weed out dynamic Proxy types; types that do not expose concrete method API that we could use to figure out automatic Bean (property) based serialization. |
| public static boolean | |
| public static String | |
| public static String | name(PropertyName name)
Returns either single-quoted (apostrophe) |
| public static String | |
| public static String | |
| public static <T> T | |
| public static String | |
| public static String | |
| public static Class | primitiveType(Class<?> type)
Method that can be used to find primitive type for given class if (but only if)
it is either wrapper type or primitive type; returns |
| public static String | |
| public static Class | |
| public static <E extends Throwable> RuntimeException | |
| public static void | throwAsIAE(Throwable t)
Method that will wrap 't' as an |
| public static void | throwAsIAE(Throwable t, String msg)
Method that will wrap 't' as an |
| public static Throwable | throwIfError(Throwable t)
Helper method that will check if argument is an |
| public static Throwable | throwIfJacksonE(Throwable t)
Helper method that will check if argument is an |
| public static Throwable | throwIfRTE(Throwable t)
Helper method that will check if argument is an |
| public static Throwable | throwRootCauseIfJacksonE(Throwable t)
Method that works like by calling |
| public static void | unwrapAndThrowAsIAE(Throwable t)
Method that will locate the innermost exception for given Throwable;
and then wrap it as an |
| public static void | unwrapAndThrowAsIAE(Throwable t, String msg)
Method that will locate the innermost exception for given Throwable;
and then wrap it as an |
| public static void | |
| public static Class | wrapperType(Class<?> primitiveType)
Helper method for finding wrapper type for given primitive type (why isn't there one in JDK?). |
| CLS_OBJECT | back to summary |
|---|---|
| private static final Class<?> CLS_OBJECT | |
| EMPTY_ITERATOR | back to summary |
|---|---|
| private static final Iterator<Object> EMPTY_ITERATOR | |
| JDK_PREFIXES | back to summary |
|---|---|
| private static final List<String> JDK_PREFIXES | |
| NO_CTORS | back to summary |
|---|---|
| private static final ClassUtil. | |
| ClassUtil | back to summary |
|---|---|
| public ClassUtil() | |
| _addRawSuperTypes | back to summary |
|---|---|
| private static void _addRawSuperTypes(Class<?> cls, Class<?> endBefore, Collection<Class<?>> result, boolean addClassItself) | |
| _failGetClassMethods | back to summary |
|---|---|
| private static Method[] _failGetClassMethods(Class<?> cls, Throwable rootCause) throws IllegalArgumentException | |
| apostrophed | back to summary |
|---|---|
| public static String apostrophed(String text) Returns either | |
| backticked | back to summary |
|---|---|
| public static String backticked(String text) Returns either | |
| canBeABeanType | back to summary |
|---|---|
public static String canBeABeanType(Class<?> type)
| |
| checkAndFixAccess | back to summary |
|---|---|
| public static void checkAndFixAccess(Member member, boolean evenIfAlreadyPublic) Method that is called if a
| |
| classNameOf | back to summary |
|---|---|
| public static String classNameOf(Object inst) Helper method used to construct appropriate description when passed either type (Class) or an instance; in latter case, class of instance is to be used. | |
| classOf | back to summary |
|---|---|
| public static Class | |
| closeOnFailAndThrowAsJacksonE | back to summary |
|---|---|
| public static void closeOnFailAndThrowAsJacksonE(JsonGenerator g, Exception fail) throws JacksonException Helper method that encapsulate logic in trying to close output generator in case of failure; useful mostly in forcing flush()ing as otherwise error conditions tend to be hard to diagnose. However, it is often the case that output state may be corrupt so we need to be prepared for secondary exception without masking original one.
Note that exception is thrown as-is if unchecked (likely case); if it is
checked, however,
| |
| closeOnFailAndThrowAsJacksonE | back to summary |
|---|---|
| public static void closeOnFailAndThrowAsJacksonE(JsonGenerator g, AutoCloseable toClose, Exception fail) throws JacksonException Helper method that encapsulate logic in trying to close given | |
| createInstance | back to summary |
|---|---|
| public static <T> T createInstance(Class<T> cls, boolean canFixAccess) throws IllegalArgumentException Method that can be called to try to create an instantiate of specified type. Instantiation is done using default no-argument constructor.
| |
| defaultValue | back to summary |
|---|---|
| public static Object defaultValue(Class<?> cls) Helper method used to get default value for wrappers used for primitive types (0 for Integer etc) | |
| emptyIterator | back to summary |
|---|---|
public static <T> Iterator
| |
| emptyStream | back to summary |
|---|---|
public static <T> Stream
| |
| exceptionMessage | back to summary |
|---|---|
| public static String exceptionMessage(Throwable t) Helper method that returns | |
| findConstructor | back to summary |
|---|---|
| public static <T> Constructor | |
| findEnumType | back to summary |
|---|---|
| public static Class Helper method that can be used to dynamically figure out
enumeration type of given | |
| findEnumType | back to summary |
|---|---|
| public static Class Helper method that can be used to dynamically figure out
enumeration type of given | |
| findEnumType | back to summary |
|---|---|
| public static Class Helper method that can be used to dynamically figure out formal enumeration type (class) for given enumeration. This is either class of enum instance (for "simple" enumerations), or its superclass (for enums with instance fields or methods) | |
| findEnumType | back to summary |
|---|---|
| public static Class Helper method that can be used to dynamically figure out formal enumeration type (class) for given class of an enumeration value. This is either class of enum instance (for "simple" enumerations), or its superclass (for enums with instance fields or methods)
| |
| findRawSuperTypes | back to summary |
|---|---|
| public static List | |
| findSuperClasses | back to summary |
|---|---|
| public static List Method for finding all super classes (but not super interfaces) of given class,
starting with the immediate super class and ending in the most distant one.
Class itself is included if Note mostly/only called to resolve mix-ins as that's where we do not care about fully-resolved types, just associated annotations. | |
| getClassDescription | back to summary |
|---|---|
| public static String getClassDescription(Object classOrInstance) Helper method used to construct appropriate description when passed either type (Class) or an instance; in latter case, class of instance is to be used. | |
| getClassMethods | back to summary |
|---|---|
| public static Method[] getClassMethods(Class<?> cls) Helper method that gets methods declared in given class; usually a simple thing, but sometimes (as per [databind#785]) more complicated, depending on classloader setup.
| |
| getConstructors | back to summary |
|---|---|
public static ClassUtil.
| |
| getDeclaringClass | back to summary |
|---|---|
| public static Class | |
| getEnclosingClass | back to summary |
|---|---|
| public static Class | |
| getJDKMajorVersion | back to summary |
|---|---|
public static int getJDKMajorVersion()
| |
| getOuterClass | back to summary |
|---|---|
| public static Class Method for finding enclosing class for non-static inner classes | |
| getRootCause | back to summary |
|---|---|
| public static Throwable getRootCause(Throwable t) Method that can be used to find the "root cause", innermost of chained (wrapped) exceptions. | |
| getTypeDescription | back to summary |
|---|---|
| public static String getTypeDescription(JavaType fullType) Helper method to create and return "backticked" description of given
resolved type (or, | |
| hasClass | back to summary |
|---|---|
| public static boolean hasClass(Object inst, Class<?> raw) | |
| hasEnclosingMethod | back to summary |
|---|---|
| public static boolean hasEnclosingMethod(Class<?> cls) | |
| isBogusClass | back to summary |
|---|---|
| public static boolean isBogusClass(Class<?> cls) | |
| isCollectionMapOrArray | back to summary |
|---|---|
| public static boolean isCollectionMapOrArray(Class<?> type) | |
| isConcrete | back to summary |
|---|---|
| public static boolean isConcrete(Class<?> type) Helper method that checks if given class is a concrete one; that is, not an interface or abstract class. | |
| isConcrete | back to summary |
|---|---|
| public static boolean isConcrete(Member member) | |
| isEnumType | back to summary |
|---|---|
| public static boolean isEnumType(Class<?> rawType) Helper method that encapsulates reliable check on whether
given raw type "is an Enum", that is, is or extends | |
| isJacksonStdImpl | back to summary |
|---|---|
| public static boolean isJacksonStdImpl(Object impl) Method that can be called to determine if given Object is the default
implementation Jackson uses; as opposed to a custom serializer installed by
a module or calling application. Determination is done using
Note passing `null` is legal, and will result in | |
| isJacksonStdImpl | back to summary |
|---|---|
| public static boolean isJacksonStdImpl(Class<?> implClass) | |
| isJDK17OrAbove | back to summary |
|---|---|
| public static boolean isJDK17OrAbove() Convenience method for: return getJDKMajorVersion() >= 17that also catches any possible exceptions so it is safe to call from static contexts.
| |
| isJDKClass | back to summary |
|---|---|
| public static boolean isJDKClass(Class<?> rawType) Accessor for checking whether given
Added since some aspects of handling need to be changed for JDK types (and
possibly some extensions under | |
| isJDKCoreClass | back to summary |
|---|---|
| public static boolean isJDKCoreClass(Class<?> rawType) Similar to
| |
| isLocalType | back to summary |
|---|---|
| public static String isLocalType(Class<?> type, boolean allowNonStatic) | |
| isNonStaticInnerClass | back to summary |
|---|---|
| public static boolean isNonStaticInnerClass(Class<?> cls) | |
| isObjectOrPrimitive | back to summary |
|---|---|
| public static boolean isObjectOrPrimitive(Class<?> cls) | |
| isProxyType | back to summary |
|---|---|
| public static boolean isProxyType(Class<?> type) Helper method used to weed out dynamic Proxy types; types that do not expose concrete method API that we could use to figure out automatic Bean (property) based serialization. | |
| isRecordType | back to summary |
|---|---|
| public static boolean isRecordType(Class<?> cls) Helper method for detecting Java14-added | |
| name | back to summary |
|---|---|
| public static String name(String name) Returns either single-quoted (apostrophe) | |
| name | back to summary |
|---|---|
| public static String name(PropertyName name) Returns either single-quoted (apostrophe) | |
| nameOf | back to summary |
|---|---|
| public static String nameOf(Class<?> cls) Returns either `cls.getName()` (if `cls` not null), or "[null]" if `cls` is null. | |
| nameOf | back to summary |
|---|---|
| public static String nameOf(Named named) Returns either single-quoted (apostrophe) | |
| nonNull | back to summary |
|---|---|
| public static <T> T nonNull(T valueOrNull, T defaultValue) | |
| nonNullString | back to summary |
|---|---|
| public static String nonNullString(String str) | |
| nullOrToString | back to summary |
|---|---|
| public static String nullOrToString(Object value) | |
| primitiveType | back to summary |
|---|---|
| public static Class Method that can be used to find primitive type for given class if (but only if)
it is either wrapper type or primitive type; returns
| |
| quotedOr | back to summary |
|---|---|
| public static String quotedOr(Object str, String forNull) | |
| rawClass | back to summary |
|---|---|
| public static Class | |
| sneakyThrow | back to summary |
|---|---|
| public static <E extends Throwable> RuntimeException sneakyThrow(Throwable throwable) throws Throwable-:E Throw an exception even if it's checked and not declared.
| |
| throwAsIAE | back to summary |
|---|---|
| public static void throwAsIAE(Throwable t) Method that will wrap 't' as an | |
| throwAsIAE | back to summary |
|---|---|
| public static void throwAsIAE(Throwable t, String msg) Method that will wrap 't' as an | |
| throwIfError | back to summary |
|---|---|
| public static Throwable throwIfError(Throwable t) Helper method that will check if argument is an | |
| throwIfJacksonE | back to summary |
|---|---|
| public static Throwable throwIfJacksonE(Throwable t) throws JacksonException Helper method that will check if argument is an | |
| throwIfRTE | back to summary |
|---|---|
| public static Throwable throwIfRTE(Throwable t) Helper method that will check if argument is an | |
| throwRootCauseIfJacksonE | back to summary |
|---|---|
| public static Throwable throwRootCauseIfJacksonE(Throwable t) throws JacksonException Method that works like by calling | |
| unwrapAndThrowAsIAE | back to summary |
|---|---|
| public static void unwrapAndThrowAsIAE(Throwable t) Method that will locate the innermost exception for given Throwable;
and then wrap it as an | |
| unwrapAndThrowAsIAE | back to summary |
|---|---|
| public static void unwrapAndThrowAsIAE(Throwable t, String msg) Method that will locate the innermost exception for given Throwable;
and then wrap it as an | |
| verifyMustOverride | back to summary |
|---|---|
| public static void verifyMustOverride(Class<?> expType, Object instance, String method) | |
| wrapperType | back to summary |
|---|---|
| public static Class Helper method for finding wrapper type for given primitive type (why isn't there one in JDK?). Note throws | |
| Modifier and Type | Field and Description |
|---|---|
| private transient Annotation[] | |
| public final Constructor | |
| private transient Annotation[][] | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Constructor | |
| public Annotation[] | |
| public Class | |
| public int | |
| public Annotation[][] |
| _annotations | back to summary |
|---|---|
| private transient Annotation[] _annotations | |
| _ctor | back to summary |
|---|---|
| public final Constructor<?> _ctor | |
| _paramAnnotations | back to summary |
|---|---|
| private transient Annotation[][] _paramAnnotations | |
| _paramCount | back to summary |
|---|---|
| private int _paramCount | |
| Ctor | back to summary |
|---|---|
| public Ctor(Constructor<?> ctor) | |
| getConstructor | back to summary |
|---|---|
| public Constructor | |
| getDeclaredAnnotations | back to summary |
|---|---|
| public Annotation[] getDeclaredAnnotations() | |
| getDeclaringClass | back to summary |
|---|---|
| public Class | |
| getParamCount | back to summary |
|---|---|
| public int getParamCount() | |
| getParameterAnnotations | back to summary |
|---|---|
| public Annotation[][] getParameterAnnotations() | |
EnumMaps.
| Modifier and Type | Field and Description |
|---|---|
| private final Field | |
| private final Field | |
| private final String | |
| private final String | |
| pack-priv static final ClassUtil. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Class | |
| public Class | |
| private Object | |
| private static Field |
| enumMapTypeField | back to summary |
|---|---|
| private final Field enumMapTypeField | |
| enumSetTypeField | back to summary |
|---|---|
| private final Field enumSetTypeField | |
| failForEnumMap | back to summary |
|---|---|
| private final String failForEnumMap | |
| failForEnumSet | back to summary |
|---|---|
| private final String failForEnumSet | |
| instance | back to summary |
|---|---|
| pack-priv static final ClassUtil. | |
| EnumTypeLocator | back to summary |
|---|---|
| private EnumTypeLocator() | |
| enumTypeFor | back to summary |
|---|---|
public Class
| |
| enumTypeFor | back to summary |
|---|---|
public Class
| |
| get | back to summary |
|---|---|
| private Object get(Object bean, Field field) | |
| locateField | back to summary |
|---|---|
| private static Field locateField(Class<?> fromClass, String expectedName, Class<?> type) throws Exception | |