Package de.xima.fc.helper
Class GsonJavaTimeAdapter
- java.lang.Object
-
- de.xima.fc.helper.GsonJavaTimeAdapter
-
public class GsonJavaTimeAdapter extends Object
A collection ofTypeAdapter
s forjava.time.*
classes.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
-
-
Nested Class Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Optional<com.google.gson.TypeAdapter<T>>
forType(com.google.gson.reflect.TypeToken<T> type)
Returns the type adapter for ajava.time.*
class.static <T> Optional<com.google.gson.TypeAdapter<T>>
forType(Class<T> type)
Returns the type adapter for ajava.time.*
class.static void
registerAll(com.google.gson.GsonBuilder builder)
Registers all supported type adapters forjava.time.*
with the given builder.
-
-
-
Method Detail
-
forType
public static <T> Optional<com.google.gson.TypeAdapter<T>> forType(Class<T> type)
Returns the type adapter for ajava.time.*
class.- Type Parameters:
T
- Type for which to return the adapter.- Parameters:
type
- Type for which to return the adapter.- Returns:
- The adapter for the given
java.time.*
class, or empty when the given type is not supported (or is not ajava.time.*
class).
-
forType
public static <T> Optional<com.google.gson.TypeAdapter<T>> forType(com.google.gson.reflect.TypeToken<T> type)
Returns the type adapter for ajava.time.*
class.- Type Parameters:
T
- Type for which to return the adapter.- Parameters:
type
- Type for which to return the adapter.- Returns:
- The adapter for the given
java.time.*
class, or empty when the given type is not supported (or is not ajava.time.*
class).
-
registerAll
public static void registerAll(com.google.gson.GsonBuilder builder)
Registers all supported type adapters forjava.time.*
with the given builder.- Parameters:
builder
- Builder with which to register.
-
-