org.carrot2.util.simplexml
Class PersisterHelpers

java.lang.Object
  extended by org.carrot2.util.simplexml.PersisterHelpers

public final class PersisterHelpers
extends Object

Simple XML session context helpers.


Constructor Summary
PersisterHelpers()
           
 
Method Summary
static org.simpleframework.xml.core.Persister createPersister(ResourceLookup resourceLookup, org.simpleframework.xml.strategy.Strategy strategy)
          Create a persister with the given ResourceLookup key.
static ResourceLookup getResourceLookup(Map<Object,Object> session)
          Acquire ResourceLookup from a serialization/ deserialization session.
static
<T> T
read(ResourceLookup resourceLookup, String resource, Class<T> clazz, boolean required)
          Read and deserialize an XML resource of class clazz.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersisterHelpers

public PersisterHelpers()
Method Detail

getResourceLookup

public static ResourceLookup getResourceLookup(Map<Object,Object> session)
Acquire ResourceLookup from a serialization/ deserialization session.


createPersister

public static org.simpleframework.xml.core.Persister createPersister(ResourceLookup resourceLookup,
                                                                     org.simpleframework.xml.strategy.Strategy strategy)
Create a persister with the given ResourceLookup key.


read

public static <T> T read(ResourceLookup resourceLookup,
                         String resource,
                         Class<T> clazz,
                         boolean required)
              throws IOException
Read and deserialize an XML resource of class clazz.

Type Parameters:
T - Class to be deserialized.
Parameters:
required - If true, missing resources will throw an IOException.
Returns:
Returns the deserialized resource or null if required is false.
Throws:
IOException


Copyright (c) Dawid Weiss, Stanislaw Osinski