java.lang.Object
io.helidon.json.binding.Serializers
Utility class for serialization operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidserialize(JsonGenerator generator, JsonSerializer<OptionalDouble> serializer, OptionalDouble instance, String key, boolean writeNulls) Serializes anOptionalDoublevalue with a key using the provided serializer.static voidserialize(JsonGenerator generator, JsonSerializer<OptionalInt> serializer, OptionalInt instance, String key, boolean writeNulls) Serializes anOptionalIntvalue with a key using the provided serializer.static voidserialize(JsonGenerator generator, JsonSerializer<OptionalLong> serializer, OptionalLong instance, String key, boolean writeNulls) Serializes anOptionalLongvalue with a key using the provided serializer.static <T> voidserialize(JsonGenerator generator, JsonSerializer<T> serializer, T instance, String key, boolean writeNulls) Serializes a value with a key using the provided serializer.
-
Method Details
-
serialize
public static <T> void serialize(JsonGenerator generator, JsonSerializer<T> serializer, T instance, String key, boolean writeNulls) Serializes a value with a key using the provided serializer.- Type Parameters:
T- the type of the instance- Parameters:
generator- the JSON generatorserializer- the serializer to useinstance- the instance to serializekey- the key to writewriteNulls- whether to write null values
-
serialize
public static <T extends Optional<?>> void serialize(JsonGenerator generator, JsonSerializer<T> serializer, T instance, String key, boolean writeNulls) Serializes anOptionalvalue with a key using the provided serializer.- Type Parameters:
T- the type of the instance- Parameters:
generator- the JSON generatorserializer- the serializer to useinstance- the instance to serializekey- the key to writewriteNulls- whether to write null values
-
serialize
public static void serialize(JsonGenerator generator, JsonSerializer<OptionalInt> serializer, OptionalInt instance, String key, boolean writeNulls) Serializes anOptionalIntvalue with a key using the provided serializer.- Parameters:
generator- the JSON generatorserializer- the serializer to useinstance- the instance to serializekey- the key to writewriteNulls- whether to write null values
-
serialize
public static void serialize(JsonGenerator generator, JsonSerializer<OptionalLong> serializer, OptionalLong instance, String key, boolean writeNulls) Serializes anOptionalLongvalue with a key using the provided serializer.- Parameters:
generator- the JSON generatorserializer- the serializer to useinstance- the instance to serializekey- the key to writewriteNulls- whether to write null values
-
serialize
public static void serialize(JsonGenerator generator, JsonSerializer<OptionalDouble> serializer, OptionalDouble instance, String key, boolean writeNulls) Serializes anOptionalDoublevalue with a key using the provided serializer.- Parameters:
generator- the JSON generatorserializer- the serializer to useinstance- the instance to serializekey- the key to writewriteNulls- whether to write null values
-