Class ClassUtil
- java.lang.Object
-
- org.apache.camel.maven.packaging.generics.ClassUtil
-
public final class ClassUtil extends Object
Utility classes with respect to the class operations.- Since:
- 1.0
- Author:
- Gurkan Erdogdu
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Class<?>
getClass(Type type)
Gets the class of the given type arguments.static Class<?>
getClazz(Type type)
Return raw class type for given type.static Class<?>
getPrimitiveWrapper(Class<?> clazz)
static boolean
hasAnnotation(String fqAnnotationName, Class<?> cl)
static boolean
isClassAssignableFrom(Class<?> lhs, Class<?> rhs)
Returns true if rhs is assignable type to the lhs, false otherwise.static boolean
isParameterizedType(Type type)
Returns true if type is an instance ofParameterizedType
else otherwise.static boolean
isRawClassEquals(Type ipType, Type apiType)
static boolean
isSame(Type type1, Type type2)
static boolean
isWildCardType(Type type)
Returns true if type is an instance ofWildcardType
else otherwise.
-
-
-
Method Detail
-
getClass
public static Class<?> getClass(Type type)
Gets the class of the given type arguments.If the given type
Type
parameters is an instance of theParameterizedType
, it returns the raw type otherwise it return the castedClass
of the type argument.- Parameters:
type
- class or parametrized type- Returns:
-
isParameterizedType
public static boolean isParameterizedType(Type type)
Returns true if type is an instance ofParameterizedType
else otherwise.- Parameters:
type
- type of the artifact- Returns:
- true if type is an instance of
ParameterizedType
-
isWildCardType
public static boolean isWildCardType(Type type)
Returns true if type is an instance ofWildcardType
else otherwise.- Parameters:
type
- type of the artifact- Returns:
- true if type is an instance of
WildcardType
-
isClassAssignableFrom
public static boolean isClassAssignableFrom(Class<?> lhs, Class<?> rhs)
Returns true if rhs is assignable type to the lhs, false otherwise.- Parameters:
lhs
- left hand side classrhs
- right hand side class- Returns:
- true if rhs is assignable to lhs
-
getClazz
public static Class<?> getClazz(Type type)
Return raw class type for given type.- Parameters:
type
- base type instance- Returns:
- class type for given type
-
hasAnnotation
public static boolean hasAnnotation(String fqAnnotationName, Class<?> cl)
- Parameters:
fqAnnotationName
- a fully qualified runtime annotation name whose presence on the given class is to be checkedcl
- the class to check- Returns:
true
if the givenClass
is annotated with the given runtime annotation;false
otherwise
-
-