Interface TypeVariable

All Superinterfaces:
AnnotationTarget, Type

public interface TypeVariable extends Type
Type variables represent type parameters declared on generic classes or methods. All type variables have bounds. A type variable with no bound declared is equivalent to a type variable with a single bound of java.lang.Object and is represented as such. If one bound is declared, it is a type variable or a class type, possibly parameterized. If more than one bound is declared, the first bound is a class type or an interface type, possibly parameterized, and the following bounds are interface types, possibly parameterized.
  • Method Details

    • name

      String name()
      Returns the name of this type variable.
      Returns:
      the name of this type variable, never null
    • bounds

      List<Type> bounds()
      Returns the bounds declared for this type variable.
      Returns:
      the bounds declared for this type variable, never null or empty
    • kind

      default Type.Kind kind()
      Description copied from interface: Type
      Returns the kind of this type.
      Specified by:
      kind in interface Type
      Returns:
      the kind of this type
    • asTypeVariable

      default TypeVariable asTypeVariable()
      Description copied from interface: Type
      Returns this type as a type variable. Type variables are also used to represent type parameters in declarations of parameterized types.
      Specified by:
      asTypeVariable in interface Type
      Returns:
      this type variable, never null