|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.washington.cs.sounddetector.server.api.MethodConverter
public class MethodConverter
MethodConverter handles the serialization and deserialization of Method and MethodResult objects. It also provides a way to retrieve the class of a method implementation given its name.
MethodConverter is immutable and threadsafe.
Method Summary | ||
---|---|---|
|
deserializeMethod(Reader reader,
Class<T> type)
Deserializes from contents of the given reader into a Method of the given type. |
|
|
deserializeMethod(String serialized,
Class<T> type)
Deserializes the contents of the given String into a Method of the given type. |
|
|
deserializeResult(Reader reader,
Class<T> type)
Deserializes from the contents of the given reader into a MethodResult of the given type. |
|
|
deserializeResult(String serialized,
Class<T> type)
Deserializes the contents of the given String into a MethodResult of the given type. |
|
static MethodConverter |
getInstance()
|
|
Class<? extends Method> |
getMethodClass(String methodName)
Returns the class implementing the Method interface which corresponds to the given methodName. |
|
String |
serializeMethod(Method command)
Converts the given command into its serialized form which can be sent over the wire. |
|
|
serializeResult(MethodResult<T> result)
Converts the given result into its serialized form which can be sent over the wire. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public String serializeMethod(Method command) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
command
- the command to serialize.
IOException
org.codehaus.jackson.map.JsonMappingException
org.codehaus.jackson.JsonGenerationException
public <T extends Method> String serializeResult(MethodResult<T> result) throws org.codehaus.jackson.JsonGenerationException, org.codehaus.jackson.map.JsonMappingException, IOException
result
- the result to serialize
IOException
org.codehaus.jackson.map.JsonMappingException
org.codehaus.jackson.JsonGenerationException
public <T extends Method> T deserializeMethod(Reader reader, Class<T> type) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, IOException
reader
- a Reader ready to stream the serialized form of a Method. The reader will still be
open after the call.type
- the type of Method to deserialize the contents of the reader into.
IOException
org.codehaus.jackson.map.JsonMappingException
org.codehaus.jackson.JsonParseException
public <T extends Method> T deserializeMethod(String serialized, Class<T> type) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, IOException
serialized
- a String containing the serialized form of a Method.type
- the type of Method to deserialize the contents of serialized into.
IOException
org.codehaus.jackson.map.JsonMappingException
org.codehaus.jackson.JsonParseException
public <T extends MethodResult<?>> T deserializeResult(Reader reader, Class<T> type) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, IOException
reader
- a Reader ready to stream the serialized form of a MethodResult. The reader will
still be open after the call.type
- the type of MethodResult to deserialize the contents of the reader into.
IOException
org.codehaus.jackson.map.JsonMappingException
org.codehaus.jackson.JsonParseException
public <T extends MethodResult<?>> T deserializeResult(String serialized, Class<T> type) throws org.codehaus.jackson.JsonParseException, org.codehaus.jackson.map.JsonMappingException, IOException
serialized
- a String containing the serialized form of a MethodResulttype
- the type of MethodResult to deserialize the String into
IOException
org.codehaus.jackson.map.JsonMappingException
org.codehaus.jackson.JsonParseException
public Class<? extends Method> getMethodClass(String methodName)
methodName
- the name of a method. Returns null if no method with the given methodName exists.
public static MethodConverter getInstance()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |