org.elasticsearch.common.inject.util.Types

public final class Types extends
Static methods for working with types.
Since:
2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    static
     componentType)
    Returns an array type whose elements are all instances of componentType.
    static
     elementType)
    Returns a type modelling a whose elements are of type elementType.
    static
     keyType,  valueType)
    Returns a type modelling a whose keys are of type keyType and whose values are of type valueType.
    static
     rawType, ... typeArguments)
    Returns a new parameterized type, applying typeArguments to rawType.
    static
     ownerType,  rawType, ... typeArguments)
    Returns a new parameterized type, applying typeArguments to rawType and enclosed by ownerType.
    static
     providedType)
    Returns a type modelling a Provider that provides elements of type elementType.
    static
     elementType)
    Returns a type modelling a whose elements are of type elementType.
    static
     bound)
    Returns a type that represents an unknown type that extends bound.
    static
     bound)
    Returns a type that represents an unknown supertype of bound.

    Methods inherited from class java.lang.

    , , , , , , , , , ,
  • Method Details

    • newParameterizedType

      public static  newParameterizedType( rawType, ... typeArguments)
      Returns a new parameterized type, applying typeArguments to rawType. 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, applying typeArguments to rawType and enclosed by ownerType.
      Returns:
      a parameterized type.
    • arrayOf

      public static  arrayOf( componentType)
      Returns an array type whose elements are all instances of componentType.
      Returns:
      a generic array type.
    • subtypeOf

      public static  subtypeOf( bound)
      Returns a type that represents an unknown type that extends bound. For example, if bound is CharSequence.class, this returns ? extends CharSequence. If bound is Object.class, this returns ?, which is shorthand for ? extends Object.
    • supertypeOf

      public static  supertypeOf( bound)
      Returns a type that represents an unknown supertype of bound. For example, if bound is String.class, this returns ? super String.
    • listOf

      public static  listOf( elementType)
      Returns a type modelling a whose elements are of type elementType.
      Returns:
      a parameterized type.
    • setOf

      public static  setOf( elementType)
      Returns a type modelling a whose elements are of type elementType.
      Returns:
      a parameterized type.
    • mapOf

      public static  mapOf( keyType,  valueType)
      Returns a type modelling a whose keys are of type keyType and whose values are of type valueType.
      Returns:
      a parameterized type.
    • providerOf

      public static  providerOf( providedType)
      Returns a type modelling a Provider that provides elements of type elementType.
      Returns:
      a parameterized type.