@HandleNull public class OptionalConverter<T> extends Object implements Converter<com.google.common.base.Optional<T>>
Constructor and Description |
---|
OptionalConverter(Converter<T> valueConverter) |
Modifier and Type | Method and Description |
---|---|
com.google.common.base.Optional<T> |
deserialize(ObjectReader reader,
Context ctx) |
void |
serialize(com.google.common.base.Optional<T> object,
ObjectWriter writer,
Context ctx) |
public void serialize(com.google.common.base.Optional<T> object, ObjectWriter writer, Context ctx) throws Exception
serialize
in interface Converter<com.google.common.base.Optional<T>>
serialize
in interface Serializer<com.google.common.base.Optional<T>>
object
- we want to serialize. The object is of type T or a subclass (if this serializer
has been registered for subclasses).writer
- to use to write data to the output stream.ctx
- the current context.JsonBindingException
JsonStreamException
Exception
public com.google.common.base.Optional<T> deserialize(ObjectReader reader, Context ctx) throws Exception
deserialize
in interface Converter<com.google.common.base.Optional<T>>
deserialize
in interface Deserializer<com.google.common.base.Optional<T>>
reader
- used to read data from.ctx
- the current context.JsonBindingException
JsonStreamException
Exception
Copyright © 2019. All rights reserved.