Class Types
java.lang.Object
org.apache.maven.di.impl.Types
Various helper methods for type processing
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic classstatic class -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Typebind(Type type, Function<TypeVariable<?>, Type> bindings) Binds a given type with actual type argumentsstatic Typebind(Type type, Map<TypeVariable<?>, Type> bindings) Binds a given type with actual type argumentsstatic GenericArrayTypegenericArrayType(Type componentType) Creates an instance ofGenericArrayTypewith a given component typestatic Type[]getActualTypeArguments(Type type) Returns an array of actual type arguments for a givenTypegetAllSuperTypes(Type original) Get all super classes and interface implemented by the given type.static Map<TypeVariable<?>, Type> getAllTypeBindings(Type type) Returns a map of all type bindings for a givenType.static Class<?> getRawType(Type type) static StringgetSimpleName(Type type) Returns a simple name for a givenTypestatic Map<TypeVariable<?>, Type> getTypeBindings(Type type) Returns a map of type bindings for a givenTypestatic TypegetUppermostType(Type[] types) Returns the most common type among given typesstatic booleanisAssignable(Type to, Type from) Tests whether afromtype is assignable tototypestatic ParameterizedTypeparameterizedType(Class<?> rawType, Type... parameters) Creates an instance ofParameterizedTypestatic ParameterizedTypeparameterizedType(Type ownerType, Type rawType, Type[] parameters) Creates an instance ofParameterizedTypestatic TypesimplifyType(Type original) static WildcardTypewildcardType(Type[] upperBounds, Type[] lowerBounds) Creates an instance ofWildcardTypebound by upper and lower boundsstatic WildcardTypeReturns an instance ofWildcardTypethat matches any typestatic WildcardTypewildcardTypeExtends(Type upperBound) Creates an instance ofWildcardTypebound by a single upper boundstatic WildcardTypewildcardTypeSuper(Type lowerBound) Creates an instance ofWildcardTypebound by a single lower bound
-
Field Details
-
NO_TYPES
-
WILDCARD_TYPE_ANY
-
-
Constructor Details
-
Types
public Types()
-
-
Method Details
-
getRawType
Returns a rawClassfor a givenType.A type can be any of
Class,ParameterizedType,WildcardType,GenericArrayTypeorTypeVariable -
getUppermostType
-
getActualTypeArguments
-
getTypeBindings
Returns a map of type bindings for a givenType -
getAllTypeBindings
Returns a map of all type bindings for a givenType. Includes type bindings from a whole class hierarchy -
bind
Binds a given type with actual type arguments- Parameters:
type- a type to be boundbindings- a map of actual types
-
bind
Binds a given type with actual type arguments- Parameters:
type- a type to be boundbindings- a lookup function for actual types
-
parameterizedType
public static ParameterizedType parameterizedType(@Nullable Type ownerType, Type rawType, Type[] parameters) Creates an instance ofParameterizedType- Parameters:
ownerType- an owner typerawType- a type to be parameterizedparameters- parameter types- Returns:
- an instance of
ParameterizedType
-
parameterizedType
Creates an instance ofParameterizedType- See Also:
-
getAllSuperTypes
-
simplifyType
-
isAssignable
Tests whether afromtype is assignable tototype- Parameters:
to- a 'to' type that should be checked for possible assignmentfrom- a 'from' type that should be checked for possible assignment- Returns:
- whether an object of type
fromis assignable to an object of typeto
-
wildcardType
Creates an instance ofWildcardTypebound by upper and lower bounds- Parameters:
upperBounds- a wildcard upper bound typeslowerBounds- a wildcard lower bound types- Returns:
- an instance of
WildcardType
-
wildcardTypeAny
Returns an instance ofWildcardTypethat matches any typeE.g.
<?>- See Also:
-
wildcardTypeExtends
Creates an instance ofWildcardTypebound by a single upper boundE.g.
<? extends UpperBound>- Parameters:
upperBound- a wildcard upper bound type- Returns:
- an instance of
WildcardType - See Also:
-
wildcardTypeSuper
Creates an instance ofWildcardTypebound by a single lower boundE.g.
<? super LowerBound>- Parameters:
lowerBound- a wildcard lower bound type- Returns:
- an instance of
WildcardType - See Also:
-
genericArrayType
Creates an instance ofGenericArrayTypewith a given component typeSame as
T[]- Parameters:
componentType- a component type of generic array- Returns:
- an instance of
GenericArrayType - See Also:
-
getSimpleName
-