com.sibvisions.rad.server.http.rest
Class JSONUtil

java.lang.Object
  extended by com.sibvisions.rad.server.http.rest.JSONUtil

public final class JSONUtil
extends Object

The JSONUtil is an internal utility class for REST handling.


Method Summary
static org.codehaus.jackson.map.ObjectMapper createObjectMapper()
          Creates a new ObjectMapper with preconfigured settings.
static PrintStream getDumpStream()
          Gets the dump stream.
static Object getObject(org.restlet.representation.Representation pRepresentation)
          Gets the result object from a representation.
static
<T> T
getObject(org.restlet.representation.Representation pRepresentation, Class pClass)
          Gets the result object from a representation.
static boolean isDumpStreamEnabled()
          Gets whether JSTOM stream dumping is enabled.
static void setDumpStream(PrintStream pStream)
          Sets the dump stream.
static void setDumpStreamEnabled(boolean pDump)
          Sets whether the JSON stream should be dumped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createObjectMapper

public static org.codehaus.jackson.map.ObjectMapper createObjectMapper()
Creates a new ObjectMapper with preconfigured settings.

Returns:
the object mapper

getObject

public static Object getObject(org.restlet.representation.Representation pRepresentation)
                        throws IOException
Gets the result object from a representation.

Parameters:
pRepresentation - the object representation
Returns:
the object from the representation
Throws:
IOException - if object creation fails

getObject

public static <T> T getObject(org.restlet.representation.Representation pRepresentation,
                              Class pClass)
                   throws IOException
Gets the result object from a representation.

Type Parameters:
T - the result object type
Parameters:
pRepresentation - the object representation
pClass - the expected class type
Returns:
the object from the representation
Throws:
IOException - if object creation fails

setDumpStreamEnabled

public static void setDumpStreamEnabled(boolean pDump)
Sets whether the JSON stream should be dumped.

Parameters:
pDump - true to enable dumps, false otherwise

isDumpStreamEnabled

public static boolean isDumpStreamEnabled()
Gets whether JSTOM stream dumping is enabled.

Returns:
true if stream dumping is enabled, false otherwise

setDumpStream

public static void setDumpStream(PrintStream pStream)
Sets the dump stream.

Parameters:
pStream - the stream or null to reset the stream to its default value (System.out)

getDumpStream

public static PrintStream getDumpStream()
Gets the dump stream.

Returns:
the stream


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.