public final class Schema extends Object
Use SchemaLoader
to load a schema from source files.
Modifier and Type | Method and Description |
---|---|
Field |
getField(ProtoMember protoMember) |
Service |
getService(ProtoType protoType)
Returns the service with the fully qualified name
name , or null if this schema defines
no such service. |
Service |
getService(String name)
Returns the service with the fully qualified name
name , or null if this schema defines
no such service. |
Type |
getType(ProtoType protoType)
Returns the type with the fully qualified name
name , or null if this schema defines no
such type. |
Type |
getType(String name)
Returns the type with the fully qualified name
name , or null if this schema defines no
such type. |
ProtoAdapter<Object> |
protoAdapter(String typeName,
boolean includeUnknown)
Returns a wire adapter for the message or enum type named
typeName . |
ProtoFile |
protoFile(String path)
Returns the proto file at
path , or null if this schema has no such file. |
com.google.common.collect.ImmutableList<ProtoFile> |
protoFiles() |
Schema |
prune(IdentifierSet identifierSet)
Returns a copy of this schema that retains only the types and services selected by
identifierSet , plus their transitive dependencies. |
public com.google.common.collect.ImmutableList<ProtoFile> protoFiles()
public ProtoFile protoFile(String path)
path
, or null if this schema has no such file.public Schema prune(IdentifierSet identifierSet)
identifierSet
, plus their transitive dependencies.public Service getService(String name)
name
, or null if this schema defines
no such service.public Service getService(ProtoType protoType)
name
, or null if this schema defines
no such service.public Type getType(String name)
name
, or null if this schema defines no
such type.public Type getType(ProtoType protoType)
name
, or null if this schema defines no
such type.public Field getField(ProtoMember protoMember)
public ProtoAdapter<Object> protoAdapter(String typeName, boolean includeUnknown)
typeName
. The returned type
adapter doesn't have model classes to encode and decode from, so instead it uses scalar types
(String, ByteString, Integer, etc.),
maps, and lists. It can both encode and decode
these objects. Map keys are field names.Copyright © 2013–2016 Square, Inc.. All rights reserved.