|
||||||||||
| 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 Map<Class<?>,Class<?>> |
PRIMITIVE_TO_WRAPPERS_MAP
|
| Method Summary | |
|---|---|
static Object |
callInstanceMethod(Method method,
Object instance,
Object[] args)
Call method on the instance with given arguments. |
static boolean |
checkBeanAndRequiredTypeisParametrized(Type beanTypeArg,
Type requiredTypeArg)
Deprecated. use checkBeanAndRequiredTypeIsParametrized(Type, Type) |
static boolean |
checkBeanAndRequiredTypeIsParametrized(Type beanTypeArg,
Type requiredTypeArg)
Check parametrized bean type and parametrized required types. |
static boolean |
checkBeanTypeAndRequiredIsTypeVariable(Type beanTypeArg,
Type requiredTypeArg)
|
static boolean |
checkEventTypeAssignability(Type eventType,
Type observerType)
Checks that event is applicable for the given observer type. |
static boolean |
checkParametrizedType(ParameterizedType pType)
Return true if it does not contain type variable for wildcard type false otherwise. |
static boolean |
checkRequiredTypeIsClassAndBeanTypeIsVariable(Type beanTypeArg,
Type requiredTypeArg)
Checking bean type and required type. |
static boolean |
checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(Type beanTypeArg,
Type requiredTypeArg)
|
static boolean |
checkRequiredTypeisWildCard(Type beanTypeArg,
Type requiredTypeArg)
Deprecated. use checkRequiredTypeIsWildCard(Type, Type) |
static boolean |
checkRequiredTypeIsWildCard(Type beanTypeArg,
Type requiredTypeArg)
Check bean type and required type. |
static Type[] |
getActualTypeArguements(Type type)
Deprecated. use getActualTypeArguments(Type) |
static Type[] |
getActualTypeArguments(Type type)
Returns declared type arguments if type is a
ParameterizedType instance, else an empty array. |
static Class<?> |
getClass(Type type)
Gets the class of the given type arguments. |
static Class<?> |
getClassFromName(String name)
|
static List<Method> |
getClassMethodsWithTypes(Class<?> clazz,
String methodName,
List<Class<?>> parameterTypes)
|
static Method |
getClassMethodWithTypes(Class<?> clazz,
String methodName,
List<Class<?>> parameterTypes)
|
static Class<?> |
getClazz(Type type)
Return raw class type for given type. |
static Method[] |
getDeclaredMethods(Class<?> clazz)
Gets the declared methods of the given class. |
static Field[] |
getFieldsWithType(WebBeansContext webBeansContext,
Class<?> clazz,
Type type)
|
static Class<?>[] |
getMethodParameterTypes(Method method)
|
Package |
getPackage(String packageName)
Gets java package if exist. |
static Class<?> |
getPrimitiveWrapper(Class<?> clazz)
|
static Class<?> |
getRawTypeForInjectionPoint(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
Returns injection point raw type. |
static Class<?> |
getReturnType(Method method)
Gets the return type of the method. |
static List<Class<?>> |
getSuperClasses(Class<?> clazz,
List<Class<?>> list)
|
static boolean |
hasFinalMethod(Class<?> clazz)
Check for class that has a final method or not. |
static boolean |
isAbstract(Integer modifier)
Check abstract modifier. |
static boolean |
isArray(Class<?> clazz)
|
static boolean |
isAssignable(Type beanType,
Type requiredType)
See specification 5.2.3. |
static boolean |
isAssignableForParametrized(ParameterizedType beanType,
ParameterizedType requiredType)
Returns true if given bean's api type is injectable to injection point required type. |
static boolean |
isClassAssignable(Class<?> lhs,
Class<?> rhs)
Returns true if rhs is assignable type to the lhs, false otherwise. |
static boolean |
isConcrete(Class<?> clazz)
Returna true if the class is not abstract and interface. |
static boolean |
isDefinitionConstainsTypeVariables(Class<?> clazz)
Deprecated. use isDefinitionContainsTypeVariables(Class) |
static boolean |
isDefinitionContainsTypeVariables(Class<?> clazz)
Learn whether the specified class is defined with type parameters. |
static boolean |
isFinal(Integer modifier)
Check final modifier. |
static boolean |
isInnerClazz(Class<?> clazz)
Check the class is inner or not |
static boolean |
isInterface(Integer modifier)
Check interface modifier. |
static boolean |
isMethodHasCheckedException(Method method)
Check method throws checked exception or not. |
static boolean |
isMethodHasParameter(Method method)
Check that method has any formal arguments. |
static boolean |
isMoreThanOneMethodWithName(String methodName,
Class<?> clazz)
|
static boolean |
isObjectMethod(String methodName)
|
static boolean |
isOverridden(Method subClassMethod,
Method superClassMethod)
Learn whether superClassMethod is overridden by subClassMethod. |
static boolean |
isOverriden(Method subClassMethod,
Method superClassMethod)
Deprecated. use isOverridden(Method, Method) |
static boolean |
isParametrizedType(Type type)
Returns true if type is an instance of ParameterizedType
else otherwise. |
static boolean |
isTypeVariable(Type type)
Returns true if type is an instance of TypeVariable
else otherwise. |
static boolean |
isUnboundedTypeVariable(Type type)
|
static boolean |
isWildCardType(Type type)
Returns true if type is an instance of WildcardType
else otherwise. |
static Object |
newInstance(WebBeansContext webBeansContext,
Class<?> clazz)
|
static Set<Type> |
setInterfaceTypeHierarchy(Set<Type> set,
Class<?> clazz)
|
static Set<Type> |
setTypeHierarchy(Set<Type> set,
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 Map<Class<?>,Class<?>> PRIMITIVE_TO_WRAPPERS_MAP
| Method Detail |
|---|
public static Object newInstance(WebBeansContext webBeansContext,
Class<?> clazz)
public static Class<?> getClassFromName(String name)
public static boolean isFinal(Integer modifier)
modifier - modifier
public static boolean isAbstract(Integer modifier)
modifier - modifier
public static boolean isInterface(Integer modifier)
modifier - modifier
public static boolean hasFinalMethod(Class<?> clazz)
clazz - check methods of it
public static boolean isInnerClazz(Class<?> clazz)
clazz - to check
public static Class<?> getPrimitiveWrapper(Class<?> clazz)
public static Class<?> getClass(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 Method[] getDeclaredMethods(Class<?> clazz)
clazz - class instance
public static boolean isMethodHasParameter(Method method)
method - method instance
public static Class<?> getReturnType(Method method)
method - method instance
public static boolean isMethodHasCheckedException(Method method)
method - method instance
public static Object callInstanceMethod(Method method,
Object instance,
Object[] args)
method - method instanceinstance - object instanceargs - arguments
public static List<Class<?>> getSuperClasses(Class<?> clazz,
List<Class<?>> list)
public static Class<?>[] getMethodParameterTypes(Method method)
public static boolean isObjectMethod(String methodName)
public static boolean isMoreThanOneMethodWithName(String methodName,
Class<?> clazz)
public Package getPackage(String packageName)
packageName - package name
public static boolean isParametrizedType(Type type)
ParameterizedType
else otherwise.
type - type of the artifact
ParameterizedTypepublic static boolean isWildCardType(Type type)
WildcardType
else otherwise.
type - type of the artifact
WildcardTypepublic static boolean isUnboundedTypeVariable(Type type)
public static boolean isTypeVariable(Type type)
TypeVariable
else otherwise.
type - type of the artifact
TypeVariablepublic static boolean isConcrete(Class<?> clazz)
clazz - class type
public static boolean isAssignable(Type beanType,
Type requiredType)
beanType - bean typerequiredType - required type
public static boolean checkEventTypeAssignability(Type eventType,
Type observerType)
eventType - event typeobserverType - observer type
public static boolean isClassAssignable(Class<?> lhs,
Class<?> rhs)
lhs - left hand side classrhs - right hand side class
public static boolean isAssignableForParametrized(ParameterizedType beanType,
ParameterizedType requiredType)
beanType - bean parametrized api typerequiredType - injection point parametrized api type
@Deprecated
public static boolean checkBeanAndRequiredTypeisParametrized(Type beanTypeArg,
Type requiredTypeArg)
checkBeanAndRequiredTypeIsParametrized(Type, Type)
beanTypeArg - parametrized bean typerequiredTypeArg - parametrized required type
public static boolean checkBeanAndRequiredTypeIsParametrized(Type beanTypeArg,
Type requiredTypeArg)
beanTypeArg - parametrized bean typerequiredTypeArg - parametrized required type
@Deprecated
public static boolean checkRequiredTypeisWildCard(Type beanTypeArg,
Type requiredTypeArg)
checkRequiredTypeIsWildCard(Type, Type)
Required type is a wildcard type.
beanTypeArg - bean typerequiredTypeArg - required type
public static boolean checkRequiredTypeIsWildCard(Type beanTypeArg,
Type requiredTypeArg)
Required type is a wildcard type.
beanTypeArg - bean typerequiredTypeArg - required type
public static boolean checkRequiredTypeIsClassAndBeanTypeIsVariable(Type beanTypeArg,
Type requiredTypeArg)
Required type is class and bean type is a type variable.
beanTypeArg - bean typerequiredTypeArg - required type
public static boolean checkRequiredTypeIsTypeVariableAndBeanTypeIsClass(Type beanTypeArg,
Type requiredTypeArg)
public static boolean checkBeanTypeAndRequiredIsTypeVariable(Type beanTypeArg,
Type requiredTypeArg)
public static List<Method> getClassMethodsWithTypes(Class<?> clazz,
String methodName,
List<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 Method getClassMethodWithTypes(Class<?> clazz,
String methodName,
List<Class<?>> parameterTypes)
public static boolean isArray(Class<?> clazz)
@Deprecated public static boolean isDefinitionConstainsTypeVariables(Class<?> clazz)
isDefinitionContainsTypeVariables(Class)
clazz - to check
public static boolean isDefinitionContainsTypeVariables(Class<?> clazz)
clazz - to check
@Deprecated public static Type[] getActualTypeArguements(Type type)
getActualTypeArguments(Type)
type is a
ParameterizedType instance, else an empty array.
Get the actual type arguments of a type.
type -
public static Type[] getActualTypeArguments(Type type)
type is a
ParameterizedType instance, else an empty array.
Get the actual type arguments of a type.
type -
public static Set<Type> setTypeHierarchy(Set<Type> set,
Type clazz)
public static Class<?> getClazz(Type type)
type - base type instance
public static Set<Type> setInterfaceTypeHierarchy(Set<Type> set,
Class<?> clazz)
public static boolean checkParametrizedType(ParameterizedType pType)
pType - parameterized type
public static Field[] getFieldsWithType(WebBeansContext webBeansContext,
Class<?> clazz,
Type type)
public static Class<?> getRawTypeForInjectionPoint(javax.enterprise.inject.spi.InjectionPoint injectionPoint)
injectionPoint - injection point definition
@Deprecated
public static boolean isOverriden(Method subClassMethod,
Method superClassMethod)
isOverridden(Method, Method)
superClassMethod is overridden by subClassMethod.
subClassMethod - potentially overridingsuperClassMethod - potentially overridden
public static boolean isOverridden(Method subClassMethod,
Method superClassMethod)
superClassMethod is overridden by subClassMethod.
subClassMethod - potentially overridingsuperClassMethod - potentially overridden
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||