public class TypeInformation extends Object
| Constructor and Description |
|---|
TypeInformation(Type type)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static TypeInformation |
fromField(Field field)
Creates a new TypeInformation instance based on the given field's type.
|
TypeInformation |
getGenericType(int index)
"Unwraps" the type and returns the generic type information for the given index, provided the wrapped type
contains generic information.
|
Class<?> |
getGenericTypeAsClass(int index)
"Unwraps" the type and returns the generic type information for the given index as Class object,
provided the wrapped type contains generic information.
|
Class<?> |
getSafeToReadClass()
Returns a
Class object of the wrapped type which is safe for reading. |
Class<?> |
getSafeToWriteClass()
Returns a
Class object of the wrapped type which is safe for writing to. |
Type |
getType() |
int |
hashCode() |
String |
toString() |
public TypeInformation(Type type)
type - the type the instance should wrappublic static TypeInformation fromField(Field field)
field - the field to create a type information forpublic Class<?> getSafeToWriteClass()
Class object of the wrapped type which is safe for writing to. In other words, if
this instance wraps the Type of a field, the returned Class of this method is guaranteed to be a valid
value for setting to the field.
Examples:
type = String -> result = String.classtype = List<String> -> result = List.classtype = ? super Integer -> result = Integer.classtype = ? extends Comparable -> result = nullpublic Class<?> getSafeToReadClass()
Class object of the wrapped type which is safe for reading. For example, if this instance
wraps the Type of a field, then the value on the field is guaranteed to be of the Class type returned by this
method (unless the value is null). The returned Class is as specific as possible.
Examples:
type = String -> result = String.classtype = List<String> -> result = List.classtype = ? super Integer -> result = Object.classtype = ? extends Comparable -> result = Comparable.class@Nullable public TypeInformation getGenericType(int index)
Examples for index = 0:
type = String -> result = nulltype = List<String> -> result = String.classtype = Map<List<Integer>, String> -> result = List<Integer>type = List -> result = nullindex - the index of the generic type to get (0-based)@Nullable public Class<?> getGenericTypeAsClass(int index)
safe-to-write Class.
Examples for index = 0:
type = String -> result = nulltype = List<String> -> result = String.classtype = Map<List<Integer>, String> -> result = List.classtype = List -> result = nullindex - the index of the generic type to get (0-based)Copyright © 2016–2018 The AuthMe Team. All rights reserved.