@Immutable public class OptionalThriftCodec<T> extends Object implements ThriftCodec<Optional<T>>
| Constructor and Description |
|---|
OptionalThriftCodec(ThriftType type,
ThriftCodec<T> elementCodec) |
| Modifier and Type | Method and Description |
|---|---|
ThriftType |
getType()
The Thrift type this codec supports.
|
boolean |
isNull(Optional<T> value)
If the value is effectively null and should not be written.
|
Optional<T> |
read(TProtocolReader protocol)
Reads a value from supplied Thrift protocol reader.
|
void |
write(Optional<T> value,
TProtocolWriter protocol)
Writes a value to the supplied Thrift protocol writer.
|
public OptionalThriftCodec(ThriftType type, ThriftCodec<T> elementCodec)
public ThriftType getType()
ThriftCodecgetType in interface ThriftCodec<Optional<T>>public Optional<T> read(TProtocolReader protocol) throws Exception
ThriftCodecread in interface ThriftCodec<Optional<T>>protocol - the protocol to read fromException - if any problems occurred when reading or coercing the valuepublic void write(Optional<T> value, TProtocolWriter protocol) throws Exception
ThriftCodecwrite in interface ThriftCodec<Optional<T>>value - the value to write; not nullprotocol - the protocol to write toException - if any problems occurred when writing or coercing the valuepublic boolean isNull(Optional<T> value)
ThriftCodecisNull in interface ThriftCodec<Optional<T>>value - the value to testCopyright © 2012–2018. All rights reserved.