AeroGear SimplePush Server Protocol 0.11.0

org.jboss.aerogear.simplepush.protocol.impl.json
Class JsonUtil

java.lang.Object
  extended by org.jboss.aerogear.simplepush.protocol.impl.json.JsonUtil

public final class JsonUtil
extends Object

JSON utility class for transforming SimplePush messages to and from JSON.


Method Summary
static
<T> T
fromJson(String json, Class<T> type)
          Transforms from JSON to the type specified.
static MessageType parseFrame(String json)
          A convenience method for transforming a SimplePush message frame into an instance of MessageType.
static String toJson(Object obj)
          Transforms from Java object notation to JSON.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromJson

public static <T> T fromJson(String json,
                             Class<T> type)
Transforms from JSON to the type specified.

Parameters:
json - the json to be transformed.
type - the Java type that the JSON should be transformed to.
Returns:
T an instance of the type populated with data from the json message.

toJson

public static String toJson(Object obj)
Transforms from Java object notation to JSON.

Parameters:
obj - the Java object to transform into JSON.
Returns:
String the json representation for the object.

parseFrame

public static MessageType parseFrame(String json)
A convenience method for transforming a SimplePush message frame into an instance of MessageType.

Parameters:
json - the JSON representing a message in the SimplePush protocol
Returns:
MessageType an instance of MessageType for the passed in json.

AeroGear SimplePush Server Protocol 0.11.0

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.