Package org.tomlj

Class GenericType<T>

java.lang.Object
org.tomlj.GenericType<T>
Type Parameters:
T - The type to bind to.

public abstract class GenericType<T> extends Object
A generic type to bind a table or array to, such as Map<String, Server> or List<Server>.

A Class cannot name a generic type, so a GenericType is created as an anonymous subclass that names it as its type argument:


 Map<String, Server> servers = table.as(new GenericType<Map<String, Server>>() {});
 
See Also:
  • Constructor Details

    • GenericType

      protected GenericType()
      Create a generic type that names the type argument of the subclass.
      Throws:
      IllegalStateException - If the subclass does not give a type argument.
  • Method Details

    • type

      public final Type type()
      The type named.
      Returns:
      The type argument of the subclass.
    • toString

      public String toString()
      Overrides:
      toString in class Object