wire-moshi-adapter / com.squareup.wire / WireJsonAdapterFactory

WireJsonAdapterFactory

class WireJsonAdapterFactory : Factory

A JsonAdapter.Factory that allows Wire messages to be serialized and deserialized using the Moshi Json library.

Moshi moshi = new Moshi.Builder()
    .add(new WireJsonAdapterFactory())
    .build();

The resulting Moshi instance will be able to serialize and deserialize Wire Message types, including extensions. It ignores unknown field values. The JSON encoding is intended to be compatible with the protobuf-java-format library.

Constructors

Name Summary
<init> WireJsonAdapterFactory()

Functions

Name Summary
create fun create(type:Type, annotations:Set<Annotation>, moshi: Moshi): JsonAdapter<*>?
plus fun plus(adapters:List<ProtoAdapter<*>>):WireJsonAdapterFactory
Returns a new WireJsonAdapterFactory that can encode the messages for adapters if they’re used with AnyMessage.fun plus(adapter: ProtoAdapter<*>):WireJsonAdapterFactory
Returns a new WireJsonAdapterFactory that can encode the messages for adapter if they’re used with AnyMessage.