Package io.airlift.drift.codec
Class ThriftCodecManager
java.lang.Object
io.airlift.drift.codec.ThriftCodecManager
ThriftCodecManager contains an index of all known ThriftCodec and can create codecs for
unknown types as needed. Since codec creation can be very expensive only one instance of this
class should be created.
-
Constructor Summary
ConstructorsConstructorDescriptionThriftCodecManager(ThriftCodecFactory factory, ThriftCatalog catalog, Set<ThriftCodec<?>> codecs) ThriftCodecManager(ThriftCodecFactory factory, ThriftCodec<?>... codecs) ThriftCodecManager(ThriftCodecFactory factory, Set<ThriftCodec<?>> codecs) ThriftCodecManager(ThriftCatalog catalog) ThriftCodecManager(ThriftCodec<?>... codecs) ThriftCodecManager(ClassLoader parent, ThriftCodec<?>... codecs) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCodec(ThriftCodec<?> codec) Adds or replaces the codec associated with the type contained in the codec.<T> ThriftCodec<T>getCachedCodecIfPresent(com.google.common.reflect.TypeToken<T> type) ThriftCodec<?><T> ThriftCodec<T>getCachedCodecIfPresent(Class<T> javaType) ThriftCodec<?>getCachedCodecIfPresent(Type javaType) <T> ThriftCodec<T>getCodec(com.google.common.reflect.TypeToken<T> type) ThriftCodec<?>getCodec(ThriftType type) <T> ThriftCodec<T>ThriftCodec<?>ThriftCodec<?>getElementCodec(ThriftTypeReference thriftTypeReference) read(ThriftType type, TProtocolReader protocol) <T> Tread(Class<T> type, TProtocolReader protocol) voidwrite(ThriftType type, Object value, TProtocolWriter protocol) <T> voidwrite(Class<T> type, T value, TProtocolWriter protocol)
-
Constructor Details
-
ThriftCodecManager
-
ThriftCodecManager
-
ThriftCodecManager
-
ThriftCodecManager
-
ThriftCodecManager
-
ThriftCodecManager
@Inject public ThriftCodecManager(ThriftCodecFactory factory, ThriftCatalog catalog, Set<ThriftCodec<?>> codecs)
-
-
Method Details
-
getElementCodec
-
getCodec
-
getCodec
-
getCodec
-
getCodec
-
getCachedCodecIfPresent
-
getCachedCodecIfPresent
-
getCachedCodecIfPresent
-
getCachedCodecIfPresent
-
addCodec
Adds or replaces the codec associated with the type contained in the codec. This does not replace any current users of the existing codec associated with the type. -
getCatalog
-
read
- Throws:
Exception
-
read
- Throws:
Exception
-
write
- Throws:
Exception
-
write
- Throws:
Exception
-