public class Protocol extends JsonProperties
A protocol consists of:
schemas
;
schemas
for exceptions;
Modifier and Type | Class and Description |
---|---|
class |
Protocol.Message
A protocol message.
|
JsonProperties.Null
Modifier and Type | Field and Description |
---|---|
static Schema |
SYSTEM_ERROR
An error that can be thrown by any message.
|
static Schema |
SYSTEM_ERRORS
Union type for generating system errors.
|
static long |
VERSION
The version of the protocol specification implemented here.
|
NULL_VALUE
Constructor and Description |
---|
Protocol(String name,
String namespace) |
Protocol(String name,
String doc,
String namespace) |
Modifier and Type | Method and Description |
---|---|
<T> Protocol.Message |
createMessage(String name,
String doc,
Map<String,T> propMap,
Schema request)
Create a one-way message.
|
<T> Protocol.Message |
createMessage(String name,
String doc,
Map<String,T> propMap,
Schema request,
Schema response,
Schema errors)
Create a two-way message.
|
Protocol.Message |
createMessage(String name,
String doc,
Schema request)
Deprecated.
|
Protocol.Message |
createMessage(String name,
String doc,
Schema request,
Schema response,
Schema errors)
Deprecated.
|
boolean |
equals(Object o) |
String |
getDoc()
Doc string for this protocol.
|
byte[] |
getMD5()
Return the MD5 hash of the text of this protocol.
|
Map<String,Protocol.Message> |
getMessages()
The messages of this protocol.
|
String |
getName()
The name of this protocol.
|
String |
getNamespace()
The namespace of this protocol.
|
Schema |
getType(String name)
Returns the named type.
|
Collection<Schema> |
getTypes()
The types of this protocol.
|
int |
hashCode() |
static void |
main(String[] args) |
static Protocol |
parse(File file)
Read a protocol from a Json file.
|
static Protocol |
parse(InputStream stream)
Read a protocol from a Json stream.
|
static Protocol |
parse(String string)
Read a protocol from a Json string.
|
static Protocol |
parse(String string,
String... more)
Read a protocol from one or more json strings
|
void |
setTypes(Collection<Schema> newTypes)
Set the types of this protocol.
|
String |
toString()
Render this as JSON.
|
String |
toString(boolean pretty)
Render this as JSON.
|
addProp, addProp, addProp, getJsonProp, getJsonProps, getObjectProp, getObjectProps, getProp, getProps
public static final long VERSION
public static final Schema SYSTEM_ERROR
public static final Schema SYSTEM_ERRORS
public String getName()
public String getNamespace()
public String getDoc()
public Collection<Schema> getTypes()
public void setTypes(Collection<Schema> newTypes)
public Map<String,Protocol.Message> getMessages()
@Deprecated public Protocol.Message createMessage(String name, String doc, Schema request)
public <T> Protocol.Message createMessage(String name, String doc, Map<String,T> propMap, Schema request)
@Deprecated public Protocol.Message createMessage(String name, String doc, Schema request, Schema response, Schema errors)
public <T> Protocol.Message createMessage(String name, String doc, Map<String,T> propMap, Schema request, Schema response, Schema errors)
public String toString(boolean pretty)
pretty
- if true, pretty-print JSON.public byte[] getMD5()
public static Protocol parse(File file) throws IOException
IOException
public static Protocol parse(InputStream stream) throws IOException
IOException
public static Protocol parse(String string, String... more)
Copyright © 2009–2017 The Apache Software Foundation. All rights reserved.