Class Types
org.elasticsearch.common.inject.util.Types
public final class Types
extends
Static methods for working with types.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic
componentType)
Returns an array type whose elements are all instances ofcomponentType
.static
elementType)
Returns a type modelling a whose elements are of typeelementType
.static
keyType, valueType)
Returns a type modelling a whose keys are of typekeyType
and whose values are of typevalueType
.static
rawType, ... typeArguments)
Returns a new parameterized type, applyingtypeArguments
torawType
.static
ownerType, rawType, ... typeArguments)
Returns a new parameterized type, applyingtypeArguments
torawType
and enclosed byownerType
.static
providedType)
Returns a type modelling aProvider
that provides elements of typeelementType
.static
elementType)
Returns a type modelling a whose elements are of typeelementType
.static
bound)
Returns a type that represents an unknown type that extendsbound
.static
bound)
Returns a type that represents an unknown supertype ofbound
.Methods inherited from class java.lang.
, , , , , , , , , ,
-
Method Details
-
newParameterizedType
public static newParameterizedType( rawType, ... typeArguments)Returns a new parameterized type, applyingtypeArguments
torawType
. The returned type does not have an owner type.- Returns:
- a parameterized type.
-
newParameterizedTypeWithOwner
public static newParameterizedTypeWithOwner( ownerType, rawType, ... typeArguments)Returns a new parameterized type, applyingtypeArguments
torawType
and enclosed byownerType
.- Returns:
- a parameterized type.
-
arrayOf
public static arrayOf( componentType)Returns an array type whose elements are all instances ofcomponentType
.- Returns:
- a generic array type.
-
subtypeOf
public static subtypeOf( bound)Returns a type that represents an unknown type that extendsbound
. For example, ifbound
isCharSequence.class
, this returns? extends CharSequence
. Ifbound
isObject.class
, this returns?
, which is shorthand for? extends Object
. -
supertypeOf
public static supertypeOf( bound)Returns a type that represents an unknown supertype ofbound
. For example, ifbound
isString.class
, this returns? super String
. -
listOf
public static listOf( elementType)Returns a type modelling a whose elements are of typeelementType
.- Returns:
- a parameterized type.
-
setOf
public static setOf( elementType)Returns a type modelling a whose elements are of typeelementType
.- Returns:
- a parameterized type.
-
mapOf
public static mapOf( keyType, valueType)Returns a type modelling a whose keys are of typekeyType
and whose values are of typevalueType
.- Returns:
- a parameterized type.
-
providerOf
public static providerOf( providedType)Returns a type modelling aProvider
that provides elements of typeelementType
.- Returns:
- a parameterized type.
-