public final class Utils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
areAssignable(java.lang.Class to,
java.lang.Class from)
Checks if both classes are assignable, including the autoboxing in case of
a primitive class.
|
static java.lang.Class<?> |
objectClass(java.lang.Object object)
Given
c the object class, returns the wrapper
class for c if c is a primitive class, returns
c otherwise. |
static java.lang.Class<?> |
resolveType(java.lang.Object target)
Resolves the target type.
|
public static java.lang.Class<?> resolveType(java.lang.Object target)
If the target is a Class
, it will be returned. If it is an
Annotation
, its type
will be
returned.
If none of the above, its class
will be returned.
target
- the target to resolve the typepublic static java.lang.Class<?> objectClass(java.lang.Object object)
c
the object
class, returns the wrapper
class for c
if c
is a primitive class, returns
c
otherwise.
This method should be used if the type could not be a primitive (in cases
of autoboxing for example). Otherwise, use the resolveType(Object)
.
object
- the object to analyse.public static boolean areAssignable(java.lang.Class to, java.lang.Class from)
true
if both classes are compatible (even if an
autoboxing is necessary).