Package org.tomlj
Class GenericType<T>
java.lang.Object
org.tomlj.GenericType<T>
- Type Parameters:
T- The type to bind to.
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>>() {});
A class between the subclass and GenericType is allowed. Its type variables are replaced with the type
arguments the subclass gives it, so with abstract class ServerMap<V> extends GenericType<Map<String, V>>,
new ServerMap<Server>() {} names Map<String, Server>.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreate a generic type that names the type argument given toGenericTypeby the subclass, resolved through any class between it andGenericType. -
Method Summary
-
Constructor Details
-
GenericType
protected GenericType()Create a generic type that names the type argument given toGenericTypeby the subclass, resolved through any class between it andGenericType.- Throws:
IllegalStateException- If no type argument is given toGenericType.
-
-
Method Details