public class DynamicProtoCoder extends ProtoCoder<com.google.protobuf.DynamicMessage>
Coder
using Google Protocol Buffers binary format. DynamicProtoCoder
supports
both Protocol Buffers syntax versions 2 and 3.
To learn more about Protocol Buffers, visit: https://developers.google.com/protocol-buffers
DynamicProtoCoder
is not registered in the global CoderRegistry
as the
descriptor is required to create the coder.
Coder.Context, Coder.NonDeterministicException
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(@Nullable java.lang.Object other) |
static CoderProvider |
getCoderProvider()
|
protected com.google.protobuf.Parser<com.google.protobuf.DynamicMessage> |
getParser()
Get the memoized
Parser , possibly initializing it lazily. |
int |
hashCode() |
static DynamicProtoCoder |
of(com.google.protobuf.Descriptors.Descriptor protoMessageDescriptor)
Returns a
DynamicProtoCoder for the Protocol Buffers DynamicMessage for the
given Descriptors.Descriptor . |
static DynamicProtoCoder |
of(ProtoDomain domain,
com.google.protobuf.Descriptors.Descriptor protoMessageDescriptor)
Returns a
DynamicProtoCoder for the Protocol Buffers DynamicMessage for the
given Descriptors.Descriptor . |
static DynamicProtoCoder |
of(ProtoDomain domain,
java.lang.String messageName)
Returns a
DynamicProtoCoder for the Protocol Buffers DynamicMessage for the
given message name in a ProtoDomain . |
DynamicProtoCoder |
withExtensionsFrom(java.lang.Iterable<java.lang.Class<?>> moreExtensionHosts)
Returns a
DynamicProtoCoder like this one, but with the extensions from the given
classes registered. |
decode, decode, encode, encode, getExtensionHosts, getExtensionRegistry, getMessageType, of, of, verifyDeterministic, withExtensionsFrom
getCoderArguments
consistentWithEquals, getEncodedElementByteSize, getEncodedTypeDescriptor, isRegisterByteSizeObserverCheap, registerByteSizeObserver, structuralValue, verifyDeterministic, verifyDeterministic
public static final long serialVersionUID
public static DynamicProtoCoder of(com.google.protobuf.Descriptors.Descriptor protoMessageDescriptor)
DynamicProtoCoder
for the Protocol Buffers DynamicMessage
for the
given Descriptors.Descriptor
.public static DynamicProtoCoder of(ProtoDomain domain, com.google.protobuf.Descriptors.Descriptor protoMessageDescriptor)
DynamicProtoCoder
for the Protocol Buffers DynamicMessage
for the
given Descriptors.Descriptor
. The message descriptor should be part of the provided
ProtoDomain
, this will ensure object equality within messages from the same domain.public static DynamicProtoCoder of(ProtoDomain domain, java.lang.String messageName)
DynamicProtoCoder
for the Protocol Buffers DynamicMessage
for the
given message name in a ProtoDomain
. The message descriptor should be part of the
provided * ProtoDomain
, this will ensure object equality within messages from the same
domain.public DynamicProtoCoder withExtensionsFrom(java.lang.Iterable<java.lang.Class<?>> moreExtensionHosts)
DynamicProtoCoder
like this one, but with the extensions from the given
classes registered.
Each of the extension host classes must be an class automatically generated by the Protocol
Buffers compiler, protoc
, that contains messages.
Does not modify this object.
withExtensionsFrom
in class ProtoCoder<com.google.protobuf.DynamicMessage>
public boolean equals(@Nullable java.lang.Object other)
equals
in class ProtoCoder<com.google.protobuf.DynamicMessage>
public int hashCode()
hashCode
in class ProtoCoder<com.google.protobuf.DynamicMessage>
protected com.google.protobuf.Parser<com.google.protobuf.DynamicMessage> getParser()
Parser
, possibly initializing it lazily.getParser
in class ProtoCoder<com.google.protobuf.DynamicMessage>
public static CoderProvider getCoderProvider()
CoderProvider
which uses the DynamicProtoCoder
for proto messages
.
This method is invoked reflectively from DefaultCoder
.