public class Type<T>
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object other) |
static <T> Type<T> |
forClass(java.lang.Class<T> clazz)
Build a new type for a given class
|
java.util.List<Generic> |
getGenerics() |
java.lang.Class<T> |
getJavaType() |
int |
hashCode() |
java.lang.String |
toString() |
Type<T> |
withGenerics(java.lang.Class<?>... generics)
This method allows you to create a type with generics.
|
Type<T> |
withGenerics(java.util.List<Type<?>> genericTypes)
This method allows you to create a type with generics.
|
Type<T> |
withGenerics(Type<?>... generics)
This method allows you to create a type with generics.
|
public java.lang.Class<T> getJavaType()
public java.util.List<Generic> getGenerics()
public Type<T> withGenerics(java.util.List<Type<?>> genericTypes) throws java.lang.IllegalArgumentException
Type.forClass(Map.class).withGenerics(Arrays.asList(Type.forClass(String.class), Type.forClass(String.class)))
If you want to represent a type with generics within generics, such as Map<String, List<String>> as, we can do this as follows:
Type.forClass(Map.class).withGenerics(Arrays.asList(Type.forClass(String.class), Type.forClass(List.class).withGenerics(String.class)))
genericTypes - generic typesjava.lang.IllegalArgumentException - thrown when to many or too few generics providedpublic Type<T> withGenerics(Type<?>... generics) throws java.lang.IllegalArgumentException
Type.forClass(List.class).withGenerics(Type.forClass(String.class))
If you want to represent a type with generics within generics, such as List<List<String>>, you can do this as follows:
Type.forClass(List.class).withGenerics(Type.forClass(List.class).withGenerics(String.class))
generics - genericsjava.lang.IllegalArgumentException - thrown when to many or too few generics providedpublic Type<T> withGenerics(java.lang.Class<?>... generics) throws java.lang.IllegalArgumentException
Type.forClass(List.class).withGenerics(String.class)
If you want to represent a type with generics within generics, see withGenerics(Type[]).generics - genericsjava.lang.IllegalArgumentException - thrown when to many or too few generics providedpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic static <T> Type<T> forClass(java.lang.Class<T> clazz)
T - typeclazz - class to wrappublic java.lang.String toString()
toString in class java.lang.Object