Package org.jboss.weld.util
Class Types
- java.lang.Object
-
- org.jboss.weld.util.Types
-
public class Types extends Object
Utility class for Types- Author:
- Pete Muir
-
-
Field Summary
Fields Modifier and Type Field Description static Function<Type,Class<?>>TYPE_TO_CLASS_FUNCTION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Class<?>boxedClass(Class<?> type)static TypeboxedType(Type type)Gets the boxed type of a classstatic <C extends Class<?>>
Map<String,C>buildClassNameMap(Iterable<C> set)Builds (class name -> class) map for given classes.static booleancontainsTypeVariable(Type type)static TypegetArrayComponentType(Type type)Determines the component type for a given array type.static TypegetCanonicalType(Class<?> clazz)Returns a canonical type for a given class.static TypegetCanonicalType(Type type)static Class<?>[]getRawTypes(Type[] types)static Set<Class<?>>getRawTypes(Set<Type> types)static StringgetTypeId(Type type)static booleanisActualType(Type type)Determines whether the given type is an actual type.static booleanisArray(Type type)Determines whether the given type is an array type.static booleanisArrayOfUnboundedTypeVariablesOrObjects(Type[] types)Determines whether the given array only contains unbounded type variables or Object.class.static booleanisIllegalBeanType(Type beanType)static booleanisMoreSpecific(Type type1, Type type2)static booleanisRawGenericType(Type type)
-
-
-
Method Detail
-
boxedType
public static Type boxedType(Type type)
Gets the boxed type of a class- Parameters:
type- The type- Returns:
- The boxed type
-
getCanonicalType
public static Type getCanonicalType(Class<?> clazz)
Returns a canonical type for a given class. If the class is a raw type of a parameterized class, the matchingParameterizedType(with unresolved type variables) is resolved. If the class is an array then the component type of the array is canonicalized Otherwise, the class is returned.- Returns:
-
containsTypeVariable
public static boolean containsTypeVariable(Type type)
-
buildClassNameMap
public static <C extends Class<?>> Map<String,C> buildClassNameMap(Iterable<C> set)
Builds (class name -> class) map for given classes.
-
isActualType
public static boolean isActualType(Type type)
Determines whether the given type is an actual type. A type is considered actual if it is a raw type, a parameterized type or an array type.- Parameters:
type- the given type- Returns:
- true if and only if the given type is an actual type
-
isArray
public static boolean isArray(Type type)
Determines whether the given type is an array type.- Parameters:
type- the given type- Returns:
- true if the given type is a subclass of java.lang.Class or implements GenericArrayType
-
getArrayComponentType
public static Type getArrayComponentType(Type type)
Determines the component type for a given array type.- Parameters:
type- the given array type- Returns:
- the component type of a given array type
-
isArrayOfUnboundedTypeVariablesOrObjects
public static boolean isArrayOfUnboundedTypeVariablesOrObjects(Type[] types)
Determines whether the given array only contains unbounded type variables or Object.class.- Parameters:
types- the given array of types- Returns:
- true if and only if the given array only contains unbounded type variables or Object.class
-
isRawGenericType
public static boolean isRawGenericType(Type type)
-
isIllegalBeanType
public static boolean isIllegalBeanType(Type beanType)
- Parameters:
beanType-- Returns:
trueif the given type is not a legal bean type,falseotherwise
-
-