Package com.fauna.codec
Class Generic
- java.lang.Object
-
- com.fauna.codec.Generic
-
public final class Generic extends java.lang.Object
A 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 aListOf
instance for the specified element type.static <K extends java.lang.String,V>
MapOf<K,V>mapOf(java.lang.Class<V> valueClass)
Creates aMapOf
instance for a map withString
keys and the specified value type.static <E> NullableDocumentOf<E>
nullableDocumentOf(java.lang.Class<E> valueClass)
Creates aNullableDocumentOf
instance for the specified element type.static <E> OptionalOf<E>
optionalOf(java.lang.Class<E> valueClass)
Creates anOptionalOf
instance for the specified element type.static <E> PageOf<E>
pageOf(java.lang.Class<E> valueClass)
Creates aPageOf
instance for the specified element type.
-
-
-
Method Detail
-
listOf
public static <E> ListOf<E> listOf(java.lang.Class<E> elementClass)
Creates aListOf
instance 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
ListOf
instance with the specified element type.
-
mapOf
public static <K extends java.lang.String,V> MapOf<K,V> mapOf(java.lang.Class<V> valueClass)
Creates aMapOf
instance for a map withString
keys 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
MapOf
instance withString
keys and the specified value type.
-
pageOf
public static <E> PageOf<E> pageOf(java.lang.Class<E> valueClass)
Creates aPageOf
instance 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
PageOf
instance with the specified element type.
-
optionalOf
public static <E> OptionalOf<E> optionalOf(java.lang.Class<E> valueClass)
Creates anOptionalOf
instance 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
OptionalOf
instance with the specified element type.
-
nullableDocumentOf
public static <E> NullableDocumentOf<E> nullableDocumentOf(java.lang.Class<E> valueClass)
Creates aNullableDocumentOf
instance 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
NullableDocumentOf
instance with the specified element type.
-
-