public class DelegateCodec<T> extends Object implements ThriftCodec<T>
ThriftCodec that defers computation of the real codec
until it is actually used, and then just delegates to that codec.
This is used to break the cycle when computing the codec for a recursive type tries to compute codecs for all of its fields.
| Constructor and Description |
|---|
DelegateCodec(ThriftCodecManager codecManager,
Type javaType) |
| Modifier and Type | Method and Description |
|---|---|
ThriftType |
getType()
The Thrift type this codec supports.
|
boolean |
isNull(T value)
If the value is effectively null and should not be written.
|
T |
read(TProtocolReader protocol)
Reads a value from supplied Thrift protocol reader.
|
void |
write(T value,
TProtocolWriter protocol)
Writes a value to the supplied Thrift protocol writer.
|
public DelegateCodec(ThriftCodecManager codecManager, Type javaType)
public ThriftType getType()
ThriftCodecgetType in interface ThriftCodec<T>public T read(TProtocolReader protocol) throws Exception
ThriftCodecread in interface ThriftCodec<T>protocol - the protocol to read fromException - if any problems occurred when reading or coercing the valuepublic void write(T value, TProtocolWriter protocol) throws Exception
ThriftCodecwrite in interface ThriftCodec<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(T value)
ThriftCodecisNull in interface ThriftCodec<T>value - the value to testCopyright © 2012–2024. All rights reserved.