Package com.fauna.codec
Class Generic
- java.lang.Object
-
- com.fauna.codec.Generic
-
public final class Generic extends java.lang.ObjectA helper class for providing static access to parameterized generic types, aiding in deserialization by circumventing type erasure.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> ListOf<E>listOf(java.lang.Class<E> elementClass)Creates aListOfinstance for the specified element type.static <K extends java.lang.String,V>
MapOf<K,V>mapOf(java.lang.Class<V> valueClass)Creates aMapOfinstance for a map withStringkeys and the specified value type.static <E> NullableDocumentOf<E>nullableDocumentOf(java.lang.Class<E> valueClass)Creates aNullableDocumentOfinstance for the specified element type.static <E> OptionalOf<E>optionalOf(java.lang.Class<E> valueClass)Creates anOptionalOfinstance for the specified element type.static <E> PageOf<E>pageOf(java.lang.Class<E> valueClass)Creates aPageOfinstance for the specified element type.
-
-
-
Method Detail
-
listOf
public static <E> ListOf<E> listOf(java.lang.Class<E> elementClass)
Creates aListOfinstance for the specified element type.- Type Parameters:
E- The type of elements in the list.- Parameters:
elementClass- The class of the elements contained in the list.- Returns:
- A
ListOfinstance with the specified element type.
-
mapOf
public static <K extends java.lang.String,V> MapOf<K,V> mapOf(java.lang.Class<V> valueClass)
Creates aMapOfinstance for a map withStringkeys and the specified value type.- Type Parameters:
K- The type of keys in the map (constrained toString).V- The type of values in the map.- Parameters:
valueClass- The class of the map's values.- Returns:
- A
MapOfinstance withStringkeys and the specified value type.
-
pageOf
public static <E> PageOf<E> pageOf(java.lang.Class<E> valueClass)
Creates aPageOfinstance for the specified element type.- Type Parameters:
E- The type of elements in the page.- Parameters:
valueClass- The class of the elements contained in the page.- Returns:
- A
PageOfinstance with the specified element type.
-
optionalOf
public static <E> OptionalOf<E> optionalOf(java.lang.Class<E> valueClass)
Creates anOptionalOfinstance for the specified element type.- Type Parameters:
E- The type of the element in the optional.- Parameters:
valueClass- The class of the elements contained in the optional.- Returns:
- An
OptionalOfinstance with the specified element type.
-
nullableDocumentOf
public static <E> NullableDocumentOf<E> nullableDocumentOf(java.lang.Class<E> valueClass)
Creates aNullableDocumentOfinstance for the specified element type.- Type Parameters:
E- The type of the element in the nullable document.- Parameters:
valueClass- The class of the elements contained in the nullable document.- Returns:
- A
NullableDocumentOfinstance with the specified element type.
-
-