|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avro.Protocol
public class Protocol
A set of messages forming an application protocol.
A protocol consists of:
schemas
;
schemas
for exceptions;
Nested Class Summary | |
---|---|
class |
Protocol.Message
A protocol message. |
Field Summary | |
---|---|
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. |
Constructor Summary | |
---|---|
Protocol(String name,
String namespace)
|
|
Protocol(String name,
String doc,
String namespace)
|
Method Summary | |
---|---|
Protocol.Message |
createMessage(String name,
String doc,
Schema request)
Create a one-way message. |
Protocol.Message |
createMessage(String name,
String doc,
Schema request,
Schema response,
Schema errors)
Create a two-way message. |
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(String string)
Read a protocol from a Json string. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final long VERSION
public static final Schema SYSTEM_ERROR
public static final Schema SYSTEM_ERRORS
Constructor Detail |
---|
public Protocol(String name, String doc, String namespace)
public Protocol(String name, String namespace)
Method Detail |
---|
public String getName()
public String getNamespace()
public String getDoc()
public Collection<Schema> getTypes()
public Schema getType(String name)
public void setTypes(Collection<Schema> newTypes)
public Map<String,Protocol.Message> getMessages()
public Protocol.Message createMessage(String name, String doc, Schema request)
public Protocol.Message createMessage(String name, String doc, Schema request, Schema response, Schema errors)
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
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(String string)
public static void main(String[] args) throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |