|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.webbeans.util.ClassUtil
public final class ClassUtil
Utility classes with respect to the class operations.
| Field Summary | |
|---|---|
static java.util.Map<java.lang.Class<?>,java.lang.Class<?>> |
PRIMITIVE_TO_WRAPPERS_MAP
|
| Method Summary | |
|---|---|
static java.lang.Object |
callInstanceMethod(java.lang.reflect.Method method,
java.lang.Object instance,
java.lang.Object[] args)
Call method on the instance with given arguments. |
static boolean |
checkBeanAndRequiredTypeisParametrized(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
Check parametrized bean type and parametrized required types. |
static boolean |
checkBeanTypeAndRequiredIsTypeVariable(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
|
static boolean |
checkEventTypeAssignability(java.lang.reflect.Type eventType,
java.lang.reflect.Type observerType)
Checks that event is applicable for the given observer type. |
static boolean |
checkParametrizedType(java.lang.reflect.ParameterizedType pType)
Return true if it does not contain type variable for wildcard type false otherwise. |
static boolean |
checkRequiredTypeIsClassAndBeanTypeIsVariable(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
Checking bean type and required type. |
static boolean |
checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
|
static boolean |
checkRequiredTypeisWildCard(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
Check bean type and required type. |
static java.lang.reflect.Type[] |
getActualTypeArguements(java.lang.reflect.Type type)
|
static java.lang.Class<?> |
getClass(java.lang.reflect.Type type)
Gets the class of the given type arguments. |
static java.lang.Class<?> |
getClassFromName(java.lang.String name)
|
static java.util.List<java.lang.reflect.Method> |
getClassMethodsWithTypes(java.lang.Class<?> clazz,
java.lang.String methodName,
java.util.List<java.lang.Class<?>> parameterTypes)
|
static java.lang.reflect.Method |
getClassMethodWithTypes(java.lang.Class<?> clazz,
java.lang.String methodName,
java.util.List<java.lang.Class<?>> parameterTypes)
|
static java.lang.Class<?> |
getClazz(java.lang.reflect.Type type)
Return raw class type for given type. |
static java.lang.reflect.Method[] |
getDeclaredMethods(java.lang.Class<?> clazz)
Gets the declared methods of the given class. |
static java.lang.reflect.Field[] |
getFieldsWithType(WebBeansContext webBeansContext,
java.lang.Class<?> clazz,
java.lang.reflect.Type type)
|
static java.lang.Class<?>[] |
getMethodParameterTypes(java.lang.reflect.Method method)
|
java.lang.Package |
getPackage(java.lang.String packageName)
Gets java package if exist. |
static java.lang.Class<?> |
getPrimitiveWrapper(java.lang.Class<?> clazz)
|
static java.lang.Class<?> |
getRawTypeForInjectionPoint(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
Returns injection point raw type. |
static java.lang.Class<?> |
getReturnType(java.lang.reflect.Method method)
Gets the return type of the method. |
static java.util.List<java.lang.Class<?>> |
getSuperClasses(java.lang.Class<?> clazz,
java.util.List<java.lang.Class<?>> list)
|
static boolean |
hasFinalMethod(java.lang.Class<?> clazz)
Check for class that has a final method or not. |
static boolean |
isAbstract(java.lang.Integer modifier)
Check abstract modifier. |
static boolean |
isArray(java.lang.Class<?> clazz)
|
static boolean |
isAssignable(java.lang.reflect.Type beanType,
java.lang.reflect.Type requiredType)
See specification 5.2.3. |
static boolean |
isAssignableForParametrized(java.lang.reflect.ParameterizedType beanType,
java.lang.reflect.ParameterizedType requiredType)
Returns true if given bean's api type is injectable to injection point required type. |
static boolean |
isClassAssignable(java.lang.Class<?> lhs,
java.lang.Class<?> rhs)
Returns true if rhs is assignable type to the lhs, false otherwise. |
static boolean |
isConcrete(java.lang.Class<?> clazz)
Returna true if the class is not abstract and interface. |
static boolean |
isDefinitionConstainsTypeVariables(java.lang.Class<?> clazz)
|
static boolean |
isFinal(java.lang.Integer modifier)
Check final modifier. |
static boolean |
isInnerClazz(java.lang.Class<?> clazz)
Check the class is inner or not |
static boolean |
isInterface(java.lang.Integer modifier)
Check interface modifier. |
static boolean |
isMethodHasCheckedException(java.lang.reflect.Method method)
Check method throws checked exception or not. |
static boolean |
isMethodHasException(java.lang.reflect.Method method)
Check method throws Exception or not. |
static boolean |
isMethodHasParameter(java.lang.reflect.Method method)
Check that method has any formal arguments. |
static boolean |
isMoreThanOneMethodWithName(java.lang.String methodName,
java.lang.Class<?> clazz)
|
static boolean |
isObjectMethod(java.lang.String methodName)
|
static boolean |
isOverriden(java.lang.reflect.Method subClassMethod,
java.lang.reflect.Method superClassMethod)
|
static boolean |
isParametrizedType(java.lang.reflect.Type type)
Returns true if type is an instance of ParameterizedType
else otherwise. |
static boolean |
isTypeVariable(java.lang.reflect.Type type)
Returns true if type is an instance of TypeVariable
else otherwise. |
static boolean |
isUnboundedTypeVariable(java.lang.reflect.Type type)
|
static boolean |
isWildCardType(java.lang.reflect.Type type)
Returns true if type is an instance of WildcardType
else otherwise. |
static java.lang.Object |
newInstance(WebBeansContext webBeansContext,
java.lang.Class<?> clazz)
|
static java.util.Set<java.lang.reflect.Type> |
setInterfaceTypeHierarchy(java.util.Set<java.lang.reflect.Type> set,
java.lang.Class<?> clazz)
|
static java.util.Set<java.lang.reflect.Type> |
setTypeHierarchy(java.util.Set<java.lang.reflect.Type> set,
java.lang.reflect.Type clazz)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.util.Map<java.lang.Class<?>,java.lang.Class<?>> PRIMITIVE_TO_WRAPPERS_MAP
| Method Detail |
|---|
public static java.lang.Object newInstance(WebBeansContext webBeansContext,
java.lang.Class<?> clazz)
public static java.lang.Class<?> getClassFromName(java.lang.String name)
public static boolean isFinal(java.lang.Integer modifier)
modifier - modifier
public static boolean isAbstract(java.lang.Integer modifier)
modifier - modifier
public static boolean isInterface(java.lang.Integer modifier)
modifier - modifier
public static boolean hasFinalMethod(java.lang.Class<?> clazz)
clazz - check methods of it
public static boolean isInnerClazz(java.lang.Class<?> clazz)
clazz - to check
public static java.lang.Class<?> getPrimitiveWrapper(java.lang.Class<?> clazz)
public static java.lang.Class<?> getClass(java.lang.reflect.Type type)
If the given type Type parameters is an instance of the
ParameterizedType, it returns the raw type otherwise it return
the casted Class of the type argument.
type - class or parametrized type
public static java.lang.reflect.Method[] getDeclaredMethods(java.lang.Class<?> clazz)
clazz - class instance
public static boolean isMethodHasParameter(java.lang.reflect.Method method)
method - method instance
public static java.lang.Class<?> getReturnType(java.lang.reflect.Method method)
method - method instance
public static boolean isMethodHasCheckedException(java.lang.reflect.Method method)
method - method instance
public static boolean isMethodHasException(java.lang.reflect.Method method)
method - method instance
public static java.lang.Object callInstanceMethod(java.lang.reflect.Method method,
java.lang.Object instance,
java.lang.Object[] args)
method - method instanceinstance - object instanceargs - arguments
public static java.util.List<java.lang.Class<?>> getSuperClasses(java.lang.Class<?> clazz,
java.util.List<java.lang.Class<?>> list)
public static java.lang.Class<?>[] getMethodParameterTypes(java.lang.reflect.Method method)
public static boolean isObjectMethod(java.lang.String methodName)
public static boolean isMoreThanOneMethodWithName(java.lang.String methodName,
java.lang.Class<?> clazz)
public java.lang.Package getPackage(java.lang.String packageName)
packageName - package name
public static boolean isParametrizedType(java.lang.reflect.Type type)
ParameterizedType
else otherwise.
type - type of the artifact
ParameterizedTypepublic static boolean isWildCardType(java.lang.reflect.Type type)
WildcardType
else otherwise.
type - type of the artifact
WildcardTypepublic static boolean isUnboundedTypeVariable(java.lang.reflect.Type type)
public static boolean isTypeVariable(java.lang.reflect.Type type)
TypeVariable
else otherwise.
type - type of the artifact
TypeVariablepublic static boolean isConcrete(java.lang.Class<?> clazz)
clazz - class type
public static boolean isAssignable(java.lang.reflect.Type beanType,
java.lang.reflect.Type requiredType)
beanType - bean typerequiredType - required type
public static boolean checkEventTypeAssignability(java.lang.reflect.Type eventType,
java.lang.reflect.Type observerType)
eventType - event typeobserverType - observer type
public static boolean isClassAssignable(java.lang.Class<?> lhs,
java.lang.Class<?> rhs)
lhs - left hand side classrhs - right hand side class
public static boolean isAssignableForParametrized(java.lang.reflect.ParameterizedType beanType,
java.lang.reflect.ParameterizedType requiredType)
beanType - bean parametrized api typerequiredType - injection point parametrized api type
public static boolean checkBeanAndRequiredTypeisParametrized(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
beanTypeArg - parametrized bean typerequiredTypeArg - parametrized required type
public static boolean checkRequiredTypeisWildCard(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
Required type is a wildcard type.
beanTypeArg - bean typerequiredTypeArg - required type
public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
Required type is class and bean type is a type variable.
beanTypeArg - bean typerequiredTypeArg - required type
public static boolean checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
public static boolean checkBeanTypeAndRequiredIsTypeVariable(java.lang.reflect.Type beanTypeArg,
java.lang.reflect.Type requiredTypeArg)
public static java.util.List<java.lang.reflect.Method> getClassMethodsWithTypes(java.lang.Class<?> clazz,
java.lang.String methodName,
java.util.List<java.lang.Class<?>> parameterTypes)
clazz - webbeans implementation classmethodName - name of the method that is searchedparameterTypes - parameter types of the method(it can be subtype of
the actual type arguments of the method)
public static java.lang.reflect.Method getClassMethodWithTypes(java.lang.Class<?> clazz,
java.lang.String methodName,
java.util.List<java.lang.Class<?>> parameterTypes)
public static boolean isArray(java.lang.Class<?> clazz)
public static boolean isDefinitionConstainsTypeVariables(java.lang.Class<?> clazz)
public static java.lang.reflect.Type[] getActualTypeArguements(java.lang.reflect.Type type)
public static java.util.Set<java.lang.reflect.Type> setTypeHierarchy(java.util.Set<java.lang.reflect.Type> set,
java.lang.reflect.Type clazz)
public static java.lang.Class<?> getClazz(java.lang.reflect.Type type)
type - base type instance
public static java.util.Set<java.lang.reflect.Type> setInterfaceTypeHierarchy(java.util.Set<java.lang.reflect.Type> set,
java.lang.Class<?> clazz)
public static boolean checkParametrizedType(java.lang.reflect.ParameterizedType pType)
pType - parameterized type
public static java.lang.reflect.Field[] getFieldsWithType(WebBeansContext webBeansContext,
java.lang.Class<?> clazz,
java.lang.reflect.Type type)
public static java.lang.Class<?> getRawTypeForInjectionPoint(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
injectionPoint - injection point definition
public static boolean isOverriden(java.lang.reflect.Method subClassMethod,
java.lang.reflect.Method superClassMethod)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||