R - the result type of the callbackpublic abstract class ClassTypeCallback<R> extends Object
ClassType, with appropriately cast method parameters.
This class's methods are meant to be overridden. The methods can be overridden partially if only certain class types
are of interest.| Constructor and Description |
|---|
ClassTypeCallback() |
| Modifier and Type | Method and Description |
|---|---|
R |
forAnnotation(Class<? extends Annotation> annotationClass)
Called when the class to process represents an annotation, such as
Override. |
R |
forArrayType(Class<?> arrayClass)
Called when the class to process is an array class, such as
int[].class or String[][].class. |
R |
forEnum(Class<? extends Enum<?>> enumClass)
Called when the class to process represents an enum, such as
TimeUnit. |
R |
forEnumEntry(Class<? extends Enum<?>> enumClass,
Class<? extends Enum<?>> enumEntryClass)
Called when the class to process is a synthetic class of an enum entry, which is created when an enum extends
the enum class anonymously (see
ClassType.ENUM_ENTRY). |
R |
forInterface(Class<?> interfaceType)
Called when the class to process is an interface, such as
Map. |
R |
forPrimitiveType(Class<?> primitiveClass)
Called when the class to process represents a primitive type, such as
int.class, or void.class. |
R |
forProxyClass(Class<?> proxyClass)
Called when the class to process is a dynamic proxy, cf.
|
R |
forRegularClass(Class<?> regularClass)
Called when the class to process is a "regular class", as explained in
ClassUtils.isRegularJavaClass(java.lang.Class<?>). |
@Nullable public R forEnum(Class<? extends Enum<?>> enumClass)
TimeUnit.enumClass - the enum class@Nullable public R forEnumEntry(Class<? extends Enum<?>> enumClass, Class<? extends Enum<?>> enumEntryClass)
ClassType.ENUM_ENTRY).
This method is called with the enum class (e.g. Range) and the concrete enum entry class that was given
to process.enumClass - the enum classenumEntryClass - the synthetic class of the enum entry@Nullable public R forAnnotation(Class<? extends Annotation> annotationClass)
Override.annotationClass - the annotation class@Nullable public R forPrimitiveType(Class<?> primitiveClass)
int.class, or void.class.primitiveClass - the primitive class (or void)@Nullable public R forArrayType(Class<?> arrayClass)
int[].class or String[][].class.
Note that the class cannot be cast to Class<? extends Object[]> without checking beforehand, due to
arrays of primitive types such as int[].class.
arrayClass - the array class@Nullable public R forInterface(Class<?> interfaceType)
Map.interfaceType - the interface@Nullable public R forProxyClass(Class<?> proxyClass)
Proxy.proxyClass - the proxy class@Nullable public R forRegularClass(Class<?> regularClass)
ClassUtils.isRegularJavaClass(java.lang.Class<?>).regularClass - the Java classCopyright © 2023. All rights reserved.