Interface TypeBuilder


public interface TypeBuilder

A type builder is used to build parameterized types.

A typical usage is:


 Type listOfStringType = Types.type(List.class).type(String.class).and().build();
 
Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Method Details

    • type

      Specifies a type as the next argument of the parameterized type.

      Parameters:
      rawType - an erased type
      Returns:
      a type argument builder with this builder as parent
    • type

      TypeBuilder type(Type type)

      Specifies a type as the next argument of the parameterized type.

      Parameters:
      type - a type
      Returns:
      this builder
    • variableType

      TypeVariableBuilder<TypeBuilder> variableType(String name)

      Specifies a variable type as the next argument of the parameterized type.

      Parameters:
      name - The name of the variable
      Returns:
      a type variable builder with this builder as parent
    • wildcardType

      Specifies a wildcard type as the next argument of the parameterized type.

      Returns:
      a wildcard type argument builder with this builder as parent
    • arrayType

      Specifies an array type as the next argument of the parameterized type.

      Returns:
      an array type argument builder with this builder as parent
    • ownerType

      TypeArgumentBuilder<TypeBuilder> ownerType(Class<?> rawType)

      Specifies the owner type of the parameterized type.

      Parameters:
      rawType - the erased type of the owner
      Returns:
      a type argument builder with this builder as parent
    • ownerType

      TypeBuilder ownerType(Type type)

      Specifies the owner type of the parameterized type.

      Parameters:
      type - the type of the owner
      Returns:
      this builder
    • build

      Type build()

      Builds the type.

      Returns:
      a parameterized type
      Throws:
      IllegalStateException - if the builder is not in a proper state to build a type