MessageConverter that reads and writes
com.google.protobuf.Messages using
Google Protocol Buffers.
To generate Message Java classes, you need to install the protoc binary.
This converter supports by default "application/x-protobuf" with the official
"com.google.protobuf:protobuf-java" library.
"application/json" can be supported with the official
"com.google.protobuf:protobuf-java-util" 3.x, with 3.3 or higher recommended.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface | ProtobufMessageConverter.
Protobuf format support. |
| pack-priv static class | ProtobufMessageConverter.
|
| Modifier and Type | Field and Description |
|---|---|
| public static final Charset | DEFAULT_CHARSET
The default charset used by the converter. |
| pack-priv final ExtensionRegistry | |
| private static final Map | |
| public static final MimeType | PROTOBUF
The mime-type for protobuf |
| private final ProtobufMessageConverter. | |
| private static final boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ProtobufMessageConverter(ExtensionRegistry extensionRegistry)
Constructor with a given |
| pack-priv | ProtobufMessageConverter(ProtobufMessageConverter.
|
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | canConvertTo(Object payload, MessageHeaders headers)
Overrides org.
|
| protected Object | convertFromInternal(Message<?>
the input message message, Class<?> the target class for the conversion targetClass, Object conversionHint)Overrides org. Convert the message payload from serialized form to an Object. |
| protected Object | convertToInternal(Object
the Object to convert payload, MessageHeaders optional headers for the message (may be headers, Object conversionHint)null)Overrides org. Convert the payload object to serialized form. |
| private Message. | |
| protected boolean | supports(Class<?>
the class to test for support clazz)Implements abstract org. Whether the given class is supported by this converter. |
| DEFAULT_CHARSET | back to summary |
|---|---|
| public static final Charset DEFAULT_CHARSET The default charset used by the converter. | |
| extensionRegistry | back to summary |
|---|---|
| pack-priv final ExtensionRegistry extensionRegistry | |
| methodCache | back to summary |
|---|---|
| private static final Map<Class<?>, Method> methodCache | |
| PROTOBUF | back to summary |
|---|---|
| public static final MimeType PROTOBUF The mime-type for protobuf | |
| protobufFormatSupport | back to summary |
|---|---|
| private final ProtobufMessageConverter. | |
| protobufJsonFormatPresent | back to summary |
|---|---|
| private static final boolean protobufJsonFormatPresent | |
| ProtobufMessageConverter | back to summary |
|---|---|
| public ProtobufMessageConverter() Constructor with a default instance of | |
| ProtobufMessageConverter | back to summary |
|---|---|
| public ProtobufMessageConverter(ExtensionRegistry extensionRegistry) Constructor with a given | |
| ProtobufMessageConverter | back to summary |
|---|---|
| pack-priv ProtobufMessageConverter(ProtobufMessageConverter. | |
| canConvertTo | back to summary |
|---|---|
| protected boolean canConvertTo(Object payload, MessageHeaders headers) Overrides org.
| |
| convertFromInternal | back to summary |
|---|---|
| protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) Overrides org. Doc from org. Convert the message payload from serialized form to an Object.
| |
| convertToInternal | back to summary |
|---|---|
| protected Object convertToInternal(Object payload, MessageHeaders headers, Object conversionHint) Overrides org. Doc from org. Convert the payload object to serialized form.
| |
| getMessageBuilder | back to summary |
|---|---|
| private Message. Create a new This method uses a ConcurrentReferenceHashMap for caching method lookups. | |
| supports | back to summary |
|---|---|
| protected boolean supports(Class<?> clazz) Implements abstract org. Doc from org. Whether the given class is supported by this converter. | |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public MimeType[] | |
| public boolean |
| merge | back to summary |
|---|---|
| public void merge(Message<?> message, Charset charset, MimeType contentType, ExtensionRegistry extensionRegistry, Message. | |
| back to summary | |
|---|---|
| public void print(Message message, OutputStream output, MimeType contentType, Charset charset) throws IOException, MessageConversionException | |
| supportedMediaTypes | back to summary |
|---|---|
| public MimeType[] supportedMediaTypes() | |
| supportsWriteOnly | back to summary |
|---|---|
| public boolean supportsWriteOnly(MimeType mediaType) | |
ProtobufFormatSupport implementation used when
com.google.protobuf.util.JsonFormat is available.
| Modifier and Type | Field and Description |
|---|---|
| private final JsonFormat. | |
| private final JsonFormat. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | merge(Message<?> message, Charset charset, MimeType contentType, ExtensionRegistry extensionRegistry, Message.
Implements org.
|
| public void | print(Message message, OutputStream output, MimeType contentType, Charset charset)
Implements org.
|
| public MimeType[] | |
| public boolean |
| parser | back to summary |
|---|---|
| private final JsonFormat. | |
| printer | back to summary |
|---|---|
| private final JsonFormat. | |
| ProtobufJavaUtilSupport | back to summary |
|---|---|
| public ProtobufJavaUtilSupport(JsonFormat. | |
| merge | back to summary |
|---|---|
| public void merge(Message<?> message, Charset charset, MimeType contentType, ExtensionRegistry extensionRegistry, Message. Implements org.
| |
| back to summary | |
|---|---|
| public void print(Message message, OutputStream output, MimeType contentType, Charset charset) throws IOException, MessageConversionException Implements org.
| |
| supportedMediaTypes | back to summary |
|---|---|
| public MimeType[] supportedMediaTypes() Implements org.
| |
| supportsWriteOnly | back to summary |
|---|---|
| public boolean supportsWriteOnly(MimeType mimeType) Implements org.
| |