Class ClassMeta<T>
- Type Parameters:
T
- The class type of the wrapped class.
- All Implemented Interfaces:
Type
Class
object that provides cached information about that class.
Instances of this class can be created through the BeanContext.getClassMeta(Class)
method.
The BeanContext
class will cache and reuse instances of this class except for the following class types:
- Arrays
- Maps with non-Object key/values.
- Collections with non-Object key/values.
This class is tied to the BeanContext
class because it's that class that makes the determination of what is
a bean.
See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canCreateNewBean
(Object outer) Returnstrue if this class can be instantiated as a bean.boolean
Returnstrue if this class has a no-arg constructor or invocation handler.boolean
canCreateNewInstance
(Object outer) Returnstrue if this class has a no-arg constructor or invocation handler.boolean
Returnstrue if this class can call thenewInstanceFromString(Object, String)
method.boolean
protected static <T> Constructor<? extends T>
findNoArgConstructor
(Class<?> c, Visibility v) Locates the no-arg constructor for the specified class.<A extends Annotation>
Optional<A>firstAnnotation
(Class<A> type, Predicate<A> filter) Returns the first matching annotation on this class or parent classes/interfaces in parent-to-child order.<A extends Annotation>
ClassMeta<T>forEachAnnotation
(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations of the specified type defined on this class or parent classes/interfaces in parent-to-child order.ClassMeta<?>
getArg
(int index) Returns the argument metadata at the specified index if this is an args metadata object.ClassMeta<?>[]
getArgs()
Returns the argument types of this meta.Returns theBeanContext
that created this object.Returns theBeanMeta
associated with this class.Returns the bean registry for this class.Returns the type property name associated with this class and subclasses.BuilderSwap<T,
?> getBuilderSwap
(BeanSession session) Returns the builder swap associated with this class.protected ObjectSwap<?,
?> getChildObjectSwapForSwap
(Class<?> normalClass) Returns theObjectSwap
where the specified class is the same/subclass of the normal class of one of the child POJO swaps associated with this class.protected ObjectSwap<?,
?> getChildObjectSwapForUnswap
(Class<?> swapClass) Returns theObjectSwap
where the specified class is the same/subclass of the swap class of one of the child POJO swaps associated with this class.org.apache.juneau.ClassMeta.ClassCategory
Returns the category of this class.Returns the no-arg constructor for this class.Returns the bean dictionary name associated with this class.ClassMeta<?>
For array andCollection
types, returns the class type of the components of the array orCollection
.getExample
(BeanSession session, JsonParserSession jpSession) Returns the example of this class.getFromMutater
(Class<I> c) Returns the transform for this class for creating instances from other object types.Returns a readable name for this class (e.g.getImplClassConstructor
(Visibility conVis) Returns the no-arg constructor for this class based on theMarshalled.implClass()
value.getInfo()
Returns theClassInfo
wrapper for the underlying class.Returns any exception that was throw in theinit() method.Returns theClass
object that this class type wraps.Returns the transform for this class for creating instances from an InputStream.ClassMeta<?>
ForMap
types, returns the class type of the keys of theMap
.<A extends Annotation>
AgetLastAnnotation
(Class<A> a) Shortcut for callinggetInnerClass().getAnnotation(a) .getName()
Shortcut for callingClass.getName()
on the inner class of this metadata.Returns the method or field annotated with@NameProperty
.Returns the reason why this class is not a bean, ornull if it is a bean.Optional<?>
If this is anOptional
, returns an empty optional.Returns the method or field annotated with@ParentProperty
.Returns the default value for primitives such asint orInteger .<T2> Optional<T2>
getProperty
(String name, Function<ClassMeta<?>, T2> function) Returns a calculated property on this context.Returns the interface proxy invocation handler for this class.All public methods on this class including static methods.Returns the transform for this class for creating instances from a Reader.ClassMeta<?>
getSerializedClassMeta
(BeanSession session) Returns the serialized (swapped) form of this class if there is anObjectSwap
associated with it.Shortcut for callingClass.getSimpleName()
on the inner class of this metadata.Returns the transform for this class for creating instances from a String.ObjectSwap<T,
?> getSwap
(BeanSession session) Returns theObjectSwap
associated with this class that's the best match for the specified session.getToMutater
(Class<O> c) Returns the transform for this class for creating instances from other object types.ClassMeta<?>
ForMap
types, returns the class type of the values of theMap
.boolean
hasAnnotation
(Class<? extends Annotation> a) Shortcut for callinggetInnerClass().getAnnotation(a) !=
.null protected boolean
Returnstrue if this class or any child classes has aObjectSwap
associated with it.int
hashCode()
boolean
Returnstrue if this class has a transform associated with it that allows it to be created from an InputStream.boolean
hasMutaterFrom
(Class<?> c) Returnstrue if this class can be instantiated from the specified type.boolean
hasMutaterFrom
(ClassMeta<?> c) Returnstrue if this class can be instantiated from the specified type.boolean
hasMutaterTo
(Class<?> c) Returnstrue if this class can be transformed to the specified type.boolean
hasMutaterTo
(ClassMeta<?> c) Returnstrue if this class can be transformed to the specified type.boolean
Returnstrue if this class has a transform associated with it that allows it to be created from a Reader.boolean
Returnstrue if this class has a transform associated with it that allows it to be created from a String.boolean
Returnstrue if the specified class is an exact match for this metadata.boolean
Returnstrue if this class is abstract.boolean
isArgs()
Returnstrue if this metadata represents an array of argument types.boolean
isArray()
Returnstrue if this class is an array.boolean
isAssignableFrom
(Class<?> c) Returnstrue if this class is a superclass of or the same as the specified class.boolean
isBean()
Returnstrue if this class is a bean.boolean
Returnstrue if this class is a subclass ofBeanMap
.boolean
Returnstrue if this class is aBoolean
.boolean
Returnstrue if this class is
.byte []boolean
Returnstrue if this class is aCalendar
.boolean
isChar()
Returnstrue if this class is aCharacter
.boolean
Returnstrue if this class is a subclass ofCharSequence
.boolean
Returnstrue if this metadata represents the specified type.boolean
isClass()
Returnstrue if this class isClass
.boolean
Returnstrue if this class is a subclass ofCollection
.boolean
Returnstrue if this class is a subclass ofCollection
or is an array.boolean
boolean
isDate()
Returnstrue if this class is aDate
.boolean
boolean
boolean
boolean
Returnstrue if this class implementsDelegate
, meaning it's a representation of some other object.boolean
isDouble()
boolean
isEnum()
Returnstrue if this class is anEnum
.boolean
isFloat()
boolean
Returnstrue if this class is anInputStream
.boolean
isInstance
(Object o) Returnstrue if the specified object is an instance of this class.boolean
isInstanceOf
(Class<?> c) Returnstrue if this class is a subclass of or the same as the specified class.boolean
boolean
isList()
Returnstrue if this class extends fromList
.boolean
isLong()
boolean
isMap()
Returnstrue if this class is a subclass ofMap
.boolean
Returnstrue if this class is a subclass ofMap
or it's a bean.boolean
Returnstrue if this class is an inner class.boolean
isMethod()
Returnstrue if this class isMethod
.boolean
Returnstrue if this class is notObject
.boolean
Returnstrue if instance of this object can benull .boolean
isNumber()
Returnstrue if this class is a subclass ofNumber
.boolean
isObject()
Returnstrue if this class isObject
.boolean
Returnstrue if this class is a subclass ofOptional
.boolean
Returnstrue if this class is a primitive.boolean
isReader()
Returnstrue if this class is aReader
.boolean
isSet()
Returnstrue if this class extends fromSet
.boolean
isShort()
boolean
isString()
Returnstrue if this class is aString
.boolean
Returnstrue if this class is aTemporal
.boolean
isUri()
boolean
isVoid()
<A extends Annotation>
Optional<A>lastAnnotation
(Class<A> type, Predicate<A> filter) Returns the last matching annotation on this class or parent classes/interfaces in parent-to-child order.mutateFrom
(Object o) Transforms the specified object into an instance of this class.<O> O
Transforms the specified object into an instance of this class.<O> O
Transforms the specified object into an instance of this class.Create a new instance of the main class of this declared type.newInstance
(Object outer) Same asnewInstance()
except for instantiating non-static member classes.newInstanceFromString
(Object outer, String arg) Create a new instance of the main class of this declared type from aString input.boolean
Similar toequals(Object)
except primitive and Object types that are similar are considered the same.toString()
toString
(boolean simple) Same astoString()
except use simple class names.Converts the specified object to a string.protected StringBuilder
toString
(StringBuilder sb, boolean simple) Appends this object as a readable string to the specified string builder.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.reflect.Type
getTypeName
-
Method Details
-
getInfo
Returns theClassInfo
wrapper for the underlying class.- Returns:
- The
ClassInfo
wrapper for the underlying class, nevernull .
-
getBeanTypePropertyName
Returns the type property name associated with this class and subclasses.If
null ,"_type" should be assumed.- Returns:
- The type property name associated with this bean class, or
null if there is no explicit type property name defined or this isn't a bean.
-
getDictionaryName
Returns the bean dictionary name associated with this class.The lexical name is defined by
@Bean(typeName)
.- Returns:
- The type name associated with this bean class, or
null if there is no type name defined or this isn't a bean.
-
getBeanRegistry
Returns the bean registry for this class.This bean registry contains names specified in the
@Bean(dictionary)
annotation defined on the class, regardless of whether the class is an actual bean. This allows interfaces to define subclasses with type names.- Returns:
- The bean registry for this class, or
null if no bean registry is associated with it.
-
getClassCategory
Returns the category of this class.- Returns:
- The category of this class.
-
isAssignableFrom
Returnstrue if this class is a superclass of or the same as the specified class.- Parameters:
c
- The comparison class.- Returns:
true if this class is a superclass of or the same as the specified class.
-
isInstanceOf
Returnstrue if this class is a subclass of or the same as the specified class.- Parameters:
c
- The comparison class.- Returns:
true if this class is a subclass of or the same as the specified class.
-
hasChildSwaps
Returnstrue if this class or any child classes has aObjectSwap
associated with it.Used when transforming bean properties to prevent having to look up transforms if we know for certain that no transforms are associated with a bean property.
- Returns:
true if this class or any child classes has aObjectSwap
associated with it.
-
getChildObjectSwapForSwap
Returns theObjectSwap
where the specified class is the same/subclass of the normal class of one of the child POJO swaps associated with this class.- Parameters:
normalClass
- The normal class being resolved.- Returns:
- The resolved
ObjectSwap
ornull if none were found.
-
getChildObjectSwapForUnswap
Returns theObjectSwap
where the specified class is the same/subclass of the swap class of one of the child POJO swaps associated with this class.- Parameters:
swapClass
- The swap class being resolved.- Returns:
- The resolved
ObjectSwap
ornull if none were found.
-
findNoArgConstructor
Locates the no-arg constructor for the specified class.Constructor must match the visibility requirements specified by parameter 'v'. If class is abstract, always returns
null . Note that this also returns the 1-arg constructor for non-static member classes.- Type Parameters:
T
- The class from which to locate the no-arg constructor.- Parameters:
c
- The class from which to locate the no-arg constructor.v
- The minimum visibility.- Returns:
- The constructor, or
null if no no-arg constructor exists with the required visibility.
-
getInnerClass
Returns theClass
object that this class type wraps.- Returns:
- The wrapped class object.
-
getSerializedClassMeta
Returns the serialized (swapped) form of this class if there is anObjectSwap
associated with it.- Parameters:
session
- The bean session.
Required because the swap used may depend on the media type being serialized or parsed.- Returns:
- The serialized class type, or this object if no swap is associated with the class.
-
getExample
Returns the example of this class.- Parameters:
session
- The bean session.
Required because the example method may take it in as a parameter.jpSession
- The JSON parser for parsing examples into POJOs.- Returns:
- The serialized class type, or this object if no swap is associated with the class.
-
getElementType
For array andCollection
types, returns the class type of the components of the array orCollection
.- Returns:
- The element class type, or
null if this class is not an array or Collection.
-
getKeyType
ForMap
types, returns the class type of the keys of theMap
.- Returns:
- The key class type, or
null if this class is not a Map.
-
getValueType
ForMap
types, returns the class type of the values of theMap
.- Returns:
- The value class type, or
null if this class is not a Map.
-
isDelegate
Returnstrue if this class implementsDelegate
, meaning it's a representation of some other object.- Returns:
true if this class implementsDelegate
.
-
is
Returnstrue if the specified class is an exact match for this metadata.- Parameters:
value
- The value to check against.- Returns:
true if the specified class is an exact match for this metadata.
-
isChildOf
Returnstrue if this metadata represents the specified type.- Parameters:
c
- The class to test against.- Returns:
true if this metadata represents the specified type.
-
isMap
Returnstrue if this class is a subclass ofMap
.- Returns:
true if this class is a subclass ofMap
.
-
isMapOrBean
Returnstrue if this class is a subclass ofMap
or it's a bean.- Returns:
true if this class is a subclass ofMap
or it's a bean.
-
isBeanMap
Returnstrue if this class is a subclass ofBeanMap
.- Returns:
true if this class is a subclass ofBeanMap
.
-
isCollection
Returnstrue if this class is a subclass ofCollection
.- Returns:
true if this class is a subclass ofCollection
.
-
isOptional
Returnstrue if this class is a subclass ofOptional
.- Returns:
true if this class is a subclass ofOptional
.
-
isCollectionOrArray
Returnstrue if this class is a subclass ofCollection
or is an array.- Returns:
true if this class is a subclass ofCollection
or is an array.
-
isCollectionOrArrayOrOptional
- Returns:
true if this class is a subclass ofCollection
or is an array orOptional
.
-
isSet
Returnstrue if this class extends fromSet
.- Returns:
true if this class extends fromSet
.
-
isList
Returnstrue if this class extends fromList
.- Returns:
true if this class extends fromList
.
-
isByteArray
Returnstrue if this class is
.byte []- Returns:
true if this class is
.byte []
-
isClass
Returnstrue if this class isClass
.- Returns:
true if this class isClass
.
-
isMethod
Returnstrue if this class isMethod
.- Returns:
true if this class isMethod
.
-
isEnum
Returnstrue if this class is anEnum
.- Returns:
true if this class is anEnum
.
-
isArray
Returnstrue if this class is an array.- Returns:
true if this class is an array.
-
isBean
Returnstrue if this class is a bean.- Returns:
true if this class is a bean.
-
isObject
Returnstrue if this class isObject
.- Returns:
true if this class isObject
.
-
isNotObject
Returnstrue if this class is notObject
.- Returns:
true if this class is notObject
.
-
isNumber
Returnstrue if this class is a subclass ofNumber
.- Returns:
true if this class is a subclass ofNumber
.
-
isDecimal
-
isFloat
- Returns:
true if this class is eitherFloat
orfloat .
-
isDouble
- Returns:
true if this class is eitherDouble
ordouble .
-
isShort
- Returns:
true if this class is eitherShort
orshort .
-
isInteger
- Returns:
true if this class is eitherInteger
orint .
-
isLong
- Returns:
true if this class is eitherLong
orlong .
-
isBoolean
Returnstrue if this class is aBoolean
.- Returns:
true if this class is aBoolean
.
-
isCharSequence
Returnstrue if this class is a subclass ofCharSequence
.- Returns:
true if this class is a subclass ofCharSequence
.
-
isString
Returnstrue if this class is aString
.- Returns:
true if this class is aString
.
-
isChar
Returnstrue if this class is aCharacter
.- Returns:
true if this class is aCharacter
.
-
isPrimitive
Returnstrue if this class is a primitive.- Returns:
true if this class is a primitive.
-
isDateOrCalendar
-
isDateOrCalendarOrTemporal
-
isDate
Returnstrue if this class is aDate
.- Returns:
true if this class is aDate
.
-
isTemporal
Returnstrue if this class is aTemporal
.- Returns:
true if this class is aTemporal
.
-
isCalendar
Returnstrue if this class is aCalendar
.- Returns:
true if this class is aCalendar
.
-
isUri
-
isReader
Returnstrue if this class is aReader
.- Returns:
true if this class is aReader
.
-
isInputStream
Returnstrue if this class is anInputStream
.- Returns:
true if this class is anInputStream
.
-
isVoid
- Returns:
true if this class isVoid
orvoid .
-
isArgs
Returnstrue if this metadata represents an array of argument types.- Returns:
true if this metadata represents an array of argument types.
-
getArgs
Returns the argument types of this meta.- Returns:
- The argument types of this meta, or
null if this isn't an array of argument types.
-
getArg
Returns the argument metadata at the specified index if this is an args metadata object.- Parameters:
index
- The argument index.- Returns:
- The The argument metadata. Never
null . - Throws:
BeanRuntimeException
- If this metadata object is not a list of arguments, or the index is out of range.
-
isNullable
Returnstrue if instance of this object can benull .Objects can be
null , but primitives cannot, except for chars which can be represented by(
.char )0- Returns:
true if instance of this class can be null.
-
isAbstract
Returnstrue if this class is abstract.- Returns:
true if this class is abstract.
-
isMemberClass
Returnstrue if this class is an inner class.- Returns:
true if this class is an inner class.
-
getPublicMethods
All public methods on this class including static methods.Keys are method signatures.
- Returns:
- The public methods on this class.
-
getSwap
Returns theObjectSwap
associated with this class that's the best match for the specified session.- Parameters:
session
- The current bean session.
If multiple swaps are associated with a class, only the first one with a matching media type will be returned.- Returns:
- The
ObjectSwap
associated with this class, ornull if there are no POJO swaps associated with this class.
-
getBuilderSwap
Returns the builder swap associated with this class.- Parameters:
session
- The current bean session.- Returns:
- The builder swap associated with this class, or
null if it doesn't exist.
-
getBeanMeta
Returns theBeanMeta
associated with this class.- Returns:
- The
BeanMeta
associated with this class, ornull if there is no bean meta associated with this class.
-
getConstructor
Returns the no-arg constructor for this class.- Returns:
- The no-arg constructor for this class, or
null if it does not exist.
-
getImplClassConstructor
Returns the no-arg constructor for this class based on theMarshalled.implClass()
value.- Parameters:
conVis
- The constructor visibility.- Returns:
- The no-arg constructor for this class, or
null if it does not exist.
-
getProxyInvocationHandler
Returns the interface proxy invocation handler for this class.- Returns:
- The interface proxy invocation handler, or
null if it does not exist.
-
canCreateNewInstance
Returnstrue if this class has a no-arg constructor or invocation handler.- Returns:
true if a new instance of this class can be constructed.
-
canCreateNewInstance
Returnstrue if this class has a no-arg constructor or invocation handler. Returnsfalse if this is a non-static member class and the outer object does not match the class type of the defining class.- Parameters:
outer
- The outer class object for non-static member classes. Can benull for non-member or static classes.- Returns:
true if a new instance of this class can be created within the context of the specified outer object.
-
canCreateNewBean
Returnstrue if this class can be instantiated as a bean. Returnsfalse if this is a non-static member class and the outer object does not match the class type of the defining class.- Parameters:
outer
- The outer class object for non-static member classes. Can benull for non-member or static classes.- Returns:
true if a new instance of this bean can be created within the context of the specified outer object.
-
canCreateNewInstanceFromString
Returnstrue if this class can call thenewInstanceFromString(Object, String)
method.- Parameters:
outer
- The outer class object for non-static member classes. Can benull for non-member or static classes.- Returns:
true if this class has a no-arg constructor or invocation handler.
-
getNameProperty
Returns the method or field annotated with@NameProperty
.- Returns:
- The method or field annotated with
@NameProperty
ornull if method does not exist.
-
getParentProperty
Returns the method or field annotated with@ParentProperty
.- Returns:
- The method or field annotated with
@ParentProperty
ornull if method does not exist.
-
getNotABeanReason
Returns the reason why this class is not a bean, ornull if it is a bean.- Returns:
- The reason why this class is not a bean, or
null if it is a bean.
-
getInitException
Returns any exception that was throw in theinit() method.- Returns:
- The cached exception.
-
getBeanContext
Returns theBeanContext
that created this object.- Returns:
- The bean context.
-
getPrimitiveDefault
Returns the default value for primitives such asint orInteger .- Returns:
- The default value, or
null if this class type is not a primitive.
-
getOptionalDefault
If this is anOptional
, returns an empty optional.Note that if this is a nested optional, will recursively create empty optionals.
- Returns:
- An empty optional, or
null if this isn't an optional.
-
toString
Converts the specified object to a string.- Parameters:
t
- The object to convert.- Returns:
- The object converted to a string, or
null if the object was null.
-
newInstanceFromString
Create a new instance of the main class of this declared type from aString input.In order to use this method, the class must have one of the following methods:
public static T valueOf(String in);public static T fromString(String in);public T(String in);
- Parameters:
outer
- The outer class object for non-static member classes. Can benull for non-member or static classes.arg
- The input argument value.- Returns:
- A new instance of the object, or
null if there is no string constructor on the object. - Throws:
ExecutableException
- Exception occurred on invoked constructor/method/field.
-
newInstance
Create a new instance of the main class of this declared type.- Returns:
- A new instance of the object, or
null if there is no no-arg constructor on the object. - Throws:
ExecutableException
- Exception occurred on invoked constructor/method/field.
-
newInstance
Same asnewInstance()
except for instantiating non-static member classes.- Parameters:
outer
- The instance of the owning object of the member class instance. Can benull if instantiating a non-member or static class.- Returns:
- A new instance of the object, or
null if there is no no-arg constructor on the object. - Throws:
ExecutableException
- Exception occurred on invoked constructor/method/field.
-
same
Similar toequals(Object)
except primitive and Object types that are similar are considered the same. (e.g.boolean ==Boolean ).- Parameters:
cm
- The class meta to compare to.- Returns:
true if the specified class-meta is equivalent to this one.
-
toString
-
toString
Same astoString()
except use simple class names.- Parameters:
simple
- Print simple class names only (no package).- Returns:
- A new string.
-
toString
Appends this object as a readable string to the specified string builder.- Parameters:
sb
- The string builder to append this object to.simple
- Print simple class names only (no package).- Returns:
- The passed-in string builder.
-
isInstance
Returnstrue if the specified object is an instance of this class.This is a simple comparison on the base class itself and not on any generic parameters.
- Parameters:
o
- The object to check.- Returns:
true if the specified object is an instance of this class.
-
getFullName
Returns a readable name for this class (e.g."java.lang.String" ,"boolean[]" ).- Returns:
- The readable name for this class.
-
getName
Shortcut for callingClass.getName()
on the inner class of this metadata.- Returns:
- The name of the inner class.
-
getSimpleName
Shortcut for callingClass.getSimpleName()
on the inner class of this metadata.- Returns:
- The simple name of the inner class.
-
hasReaderMutater
Returnstrue if this class has a transform associated with it that allows it to be created from a Reader.- Returns:
true if this class has a transform associated with it that allows it to be created from a Reader.
-
getReaderMutater
Returns the transform for this class for creating instances from a Reader.- Returns:
- The transform, or
null if no such transform exists.
-
hasInputStreamMutater
Returnstrue if this class has a transform associated with it that allows it to be created from an InputStream.- Returns:
true if this class has a transform associated with it that allows it to be created from an InputStream.
-
getInputStreamMutater
Returns the transform for this class for creating instances from an InputStream.- Returns:
- The transform, or
null if no such transform exists.
-
hasStringMutater
Returnstrue if this class has a transform associated with it that allows it to be created from a String.- Returns:
true if this class has a transform associated with it that allows it to be created from a String.
-
getStringMutater
Returns the transform for this class for creating instances from a String.- Returns:
- The transform, or
null if no such transform exists.
-
hasMutaterFrom
Returnstrue if this class can be instantiated from the specified type.- Parameters:
c
- The class type to convert from.- Returns:
true if this class can be instantiated from the specified type.
-
hasMutaterFrom
Returnstrue if this class can be instantiated from the specified type.- Parameters:
c
- The class type to convert from.- Returns:
true if this class can be instantiated from the specified type.
-
hasMutaterTo
Returnstrue if this class can be transformed to the specified type.- Parameters:
c
- The class type to convert from.- Returns:
true if this class can be transformed to the specified type.
-
hasMutaterTo
Returnstrue if this class can be transformed to the specified type.- Parameters:
c
- The class type to convert from.- Returns:
true if this class can be transformed to the specified type.
-
mutateFrom
Transforms the specified object into an instance of this class.- Parameters:
o
- The object to transform.- Returns:
- The transformed object.
-
mutateTo
Transforms the specified object into an instance of this class.- Type Parameters:
O
- The transform-to class.- Parameters:
o
- The object to transform.c
- The class- Returns:
- The transformed object.
-
mutateTo
Transforms the specified object into an instance of this class.- Type Parameters:
O
- The transform-to class.- Parameters:
o
- The object to transform.c
- The class- Returns:
- The transformed object.
-
getFromMutater
Returns the transform for this class for creating instances from other object types.- Type Parameters:
I
- The transform-from class.- Parameters:
c
- The transform-from class.- Returns:
- The transform, or
null if no such transform exists.
-
getToMutater
Returns the transform for this class for creating instances from other object types.- Type Parameters:
O
- The transform-to class.- Parameters:
c
- The transform-from class.- Returns:
- The transform, or
null if no such transform exists.
-
hasAnnotation
Shortcut for callinggetInnerClass().getAnnotation(a) !=
.null - Parameters:
a
- The annotation to check for.- Returns:
true if the inner class has the annotation.
-
getLastAnnotation
Shortcut for callinggetInnerClass().getAnnotation(a) .- Type Parameters:
A
- The annotation type to look for.- Parameters:
a
- The annotation to retrieve.- Returns:
- The specified annotation, or
null if the class does not have the specified annotation.
-
forEachAnnotation
public <A extends Annotation> ClassMeta<T> forEachAnnotation(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations of the specified type defined on this class or parent classes/interfaces in parent-to-child order.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation to search for.filter
- A predicate to apply to the entries to determine if action should be performed. Can benull .action
- An action to perform on the entry.- Returns:
- This object.
-
firstAnnotation
Returns the first matching annotation on this class or parent classes/interfaces in parent-to-child order.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation to search for.filter
- A predicate to apply to the entries to determine if annotation should be used. Can benull .- Returns:
- This object.
-
lastAnnotation
Returns the last matching annotation on this class or parent classes/interfaces in parent-to-child order.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation to search for.filter
- A predicate to apply to the entries to determine if annotation should be used. Can benull .- Returns:
- This object.
-
getProperty
Returns a calculated property on this context.- Type Parameters:
T2
- The type to convert the property to.- Parameters:
name
- The name of the property.function
- The function used to create this property.- Returns:
- The property value. Never
null .
-
hashCode
-
equals
-