Log4j 1.1

pl.psnc.expres.model.util
Class JsonReaderHelper

java.lang.Object
  extended by pl.psnc.expres.model.util.JsonReaderHelper

public class JsonReaderHelper
extends java.lang.Object

JsonReaderHelper class - used to load and parse json format resources

Author:
Dominik Stoklosa (~osa~)
Email address
osa@man.poznan.pl

Constructor Summary
JsonReaderHelper()
           
 
Method Summary
static java.lang.String jsonToString(java.lang.Object javaObject, boolean pretty)
          Convert pojo object to JSON representation
static java.lang.Object load(java.io.File fileName, java.lang.Class<?> resourceMapper)
          Load json resource and map it to the given java object (resource mapper)
static java.lang.Object load(java.io.InputStream input, java.lang.Class<?> resourceMapper)
          Load json resource and map it to the given java object (resource mapper)
static java.lang.Object load(java.lang.String fileName, java.lang.Class<?> resourceMapper)
          Load json resource and map it to the given java object (resource mapper)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonReaderHelper

public JsonReaderHelper()
Method Detail

load

public static java.lang.Object load(java.io.File fileName,
                                    java.lang.Class<?> resourceMapper)
                             throws pl.psnc.vlab.exception.ResourceNotFoundException
Load json resource and map it to the given java object (resource mapper)

Parameters:
fileName - File object representing a Json file with resource description
resourceMapper - java class which will be used to map json to java object
Returns:
java representation of json resource
Throws:
pl.psnc.vlab.exception.ResourceNotFoundException

load

public static java.lang.Object load(java.lang.String fileName,
                                    java.lang.Class<?> resourceMapper)
                             throws pl.psnc.vlab.exception.ResourceNotFoundException
Load json resource and map it to the given java object (resource mapper)

Parameters:
fileName - file containing json resource
resourceMapper - java class which will be used to map json to java object
Returns:
java representation of json resource
Throws:
pl.psnc.vlab.exception.ResourceNotFoundException

load

public static java.lang.Object load(java.io.InputStream input,
                                    java.lang.Class<?> resourceMapper)
                             throws pl.psnc.vlab.exception.ResourceNotFoundException
Load json resource and map it to the given java object (resource mapper)

Parameters:
input - input stream with json resource
resourceMapper - java class which will be used to map json to java object
Returns:
java representation of json resource
Throws:
pl.psnc.vlab.exception.ResourceNotFoundException

jsonToString

public static java.lang.String jsonToString(java.lang.Object javaObject,
                                            boolean pretty)
                                     throws com.sdicons.json.mapper.MapperException
Convert pojo object to JSON representation

Parameters:
javaObject - java object
pretty - indicating if the print should be made pretty (human readers) or compact (transmission or storage).
Returns:
JSON representation of java pojo object
Throws:
com.sdicons.json.mapper.MapperException - thrown when conversion fails

Log4j 1.1

Copyright 2007-2008 by VLAB