public class PersistRegistry extends Object
Constructor and Description |
---|
PersistRegistry() |
Modifier and Type | Method and Description |
---|---|
<S,T> PersistCodec<? super S,? extends T,? extends com.google.protobuf.Message> |
getCodec(Class<S> upperBound,
Class<T> lowerBound)
Get the codec for this protocol that encodes instances of a particular type (or subclasses)
and decodes to another type (or a subclass).
|
<T> PersistCodec<? super T,? extends T,? extends com.google.protobuf.Message> |
getCodec(Class<T> type)
Get the codec for this protocol that encodes a particular type (or subclasses)
and decodes to that same type (or a subclass).
|
<S,T extends S> |
registerCodec(Class<S> upperTypeBound,
Class<T> lowerTypeBound,
PersistCodec<S,T,?> codec)
Register a codec.
|
public <T> PersistCodec<? super T,? extends T,? extends com.google.protobuf.Message> getCodec(Class<T> type)
type
- the type to retrieve a codec fornull
if no suitable codec existspublic <S,T> PersistCodec<? super S,? extends T,? extends com.google.protobuf.Message> getCodec(Class<S> upperBound, Class<T> lowerBound)
upperBound
- the type that the encoder will acceptlowerBound
- the type that the decoder will returnnull
if no suitable codec existspublic <S,T extends S> void registerCodec(Class<S> upperTypeBound, Class<T> lowerTypeBound, PersistCodec<S,T,?> codec)
upperTypeBound
- the least-specific type supported by the codeclowerTypeBound
- the most-specific type supported by the codeccodec
- the codec itself