java.lang.Object
org.elasticsearch.common.inject.util.Types
Static methods for working with types.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic GenericArrayTypeReturns an array type whose elements are all instances ofcomponentType.static ParameterizedTypeReturns a type modelling aMapwhose keys are of typekeyTypeand whose values are of typevalueType.static ParameterizedTypenewParameterizedType(Type rawType, Type... typeArguments) Returns a new parameterized type, applyingtypeArgumentstorawType.static ParameterizedTypenewParameterizedTypeWithOwner(Type ownerType, Type rawType, Type... typeArguments) Returns a new parameterized type, applyingtypeArgumentstorawTypeand enclosed byownerType.static ParameterizedTypeproviderOf(Type providedType) Returns a type modelling aProviderthat provides elements of typeelementType.static ParameterizedTypeReturns a type modelling aSetwhose elements are of typeelementType.static WildcardTypeReturns a type that represents an unknown type that extendsbound.static WildcardTypesupertypeOf(Type bound) Returns a type that represents an unknown supertype ofbound.
-
Method Details
-
newParameterizedType
Returns a new parameterized type, applyingtypeArgumentstorawType. The returned type does not have an owner type.- Returns:
- a parameterized type.
-
newParameterizedTypeWithOwner
public static ParameterizedType newParameterizedTypeWithOwner(Type ownerType, Type rawType, Type... typeArguments) Returns a new parameterized type, applyingtypeArgumentstorawTypeand enclosed byownerType.- Returns:
- a parameterized type.
-
arrayOf
Returns an array type whose elements are all instances ofcomponentType.- Returns:
- a generic array type.
-
subtypeOf
Returns a type that represents an unknown type that extendsbound. For example, ifboundisCharSequence.class, this returns? extends CharSequence. IfboundisObject.class, this returns?, which is shorthand for? extends Object. -
supertypeOf
Returns a type that represents an unknown supertype ofbound. For example, ifboundisString.class, this returns? super String. -
setOf
Returns a type modelling aSetwhose elements are of typeelementType.- Returns:
- a parameterized type.
-
mapOf
Returns a type modelling aMapwhose keys are of typekeyTypeand whose values are of typevalueType.- Returns:
- a parameterized type.
-
providerOf
Returns a type modelling aProviderthat provides elements of typeelementType.- Returns:
- a parameterized type.
-