|
Carrot2 v3.6.0-SNAPSHOT
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.util.simplexml.SimpleXmlWrappers
public class SimpleXmlWrappers
Enables SimpleXML-based serialization of collections of arbitrary types, also those contained in libraries. Depending on the actual type, 3 wrapping scenarios are possible:
Class,
String and Enum, are handled directly by SimpleXmlWrapperValue,
no extra code is required for serialization / deserialization.Root annotation will not be wrapped and serialized / deserialized directly by
SimpleXMLISimpleXmlWrapper
implementation must be registered using the addWrapper(Class, Class) method.
| Constructor Summary | |
|---|---|
SimpleXmlWrappers()
|
|
| Method Summary | ||
|---|---|---|
static
|
addWrapper(Class<T> wrappedClass,
Class<? extends ISimpleXmlWrapper<? super T>> wrapperClass)
Registers a new ISimpleXmlWrapper. |
|
static
|
addWrapper(Class<T> wrappedClass,
Class<? extends ISimpleXmlWrapper<? super T>> wrapperClass,
boolean strict)
Registers a new ISimpleXmlWrapper. |
|
static Collection<Object> |
unwrap(Collection<SimpleXmlWrapperValue> wrapped,
Collection<Object> unwrapped)
Unwraps the provided collection after deserialization. |
|
static List<Object> |
unwrap(List<SimpleXmlWrapperValue> wrapped)
Unwraps the provided list after deserialization. |
|
static
|
unwrap(Map<K,SimpleXmlWrapperValue> wrapped)
Unwraps the provided map after deserialization. |
|
static Set<Object> |
unwrap(Set<SimpleXmlWrapperValue> wrapped)
Unwraps the provided set after deserialization. |
|
static
|
unwrap(SimpleXmlWrapperValue value)
Unwraps an object after deserialization. |
|
static Collection<SimpleXmlWrapperValue> |
wrap(Collection<?> toWrap,
Collection<SimpleXmlWrapperValue> wrapped)
Wraps the provided collection for serialization. |
|
static List<SimpleXmlWrapperValue> |
wrap(List<?> toWrap)
Wraps the provided list for serialization. |
|
static
|
wrap(Map<K,?> toWrap)
Wraps the provided map for serialization. |
|
static SimpleXmlWrapperValue |
wrap(Object value)
Wraps an individual object for serialization. |
|
static Set<SimpleXmlWrapperValue> |
wrap(Set<?> toWrap)
Wraps the provided set for serialization. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleXmlWrappers()
| Method Detail |
|---|
public static <T> void addWrapper(Class<T> wrappedClass,
Class<? extends ISimpleXmlWrapper<? super T>> wrapperClass)
ISimpleXmlWrapper. If a wrapper for the provide
wrappedClass already exists, it will be replaced with the new value.
The wrapper mapping added using this method will be strict, it will apply only to
objects of wrappedClass, but not its subclasses.
wrappedClass - type to be wrappedwrapperClass - class name of the ISimpleXmlWrapper implementation to
wrap wrappedClassaddWrapper(Class, Class, boolean)
public static <T> void addWrapper(Class<T> wrappedClass,
Class<? extends ISimpleXmlWrapper<? super T>> wrapperClass,
boolean strict)
ISimpleXmlWrapper. If a wrapper for the provide
wrappedClass already exists, it will be replaced with the new value.
wrappedClass - type to be wrappedwrapperClass - class name of the ISimpleXmlWrapper implementation to
wrap wrappedClassstrict - if true, the mapping will apply only to objects of
wrappedClass, but not to its subclasses. If
false, if no exact mapping is found for
wrappedClass, the first available superclass mapping will
be sought.public static <K> Map<K,SimpleXmlWrapperValue> wrap(Map<K,?> toWrap)
public static <K> Map<K,Object> unwrap(Map<K,SimpleXmlWrapperValue> wrapped)
public static List<SimpleXmlWrapperValue> wrap(List<?> toWrap)
public static List<Object> unwrap(List<SimpleXmlWrapperValue> wrapped)
public static Set<SimpleXmlWrapperValue> wrap(Set<?> toWrap)
public static Set<Object> unwrap(Set<SimpleXmlWrapperValue> wrapped)
public static Collection<SimpleXmlWrapperValue> wrap(Collection<?> toWrap,
Collection<SimpleXmlWrapperValue> wrapped)
toWrap - collection to wrapwrapped - collection to which wrapped values will be added
public static Collection<Object> unwrap(Collection<SimpleXmlWrapperValue> wrapped,
Collection<Object> unwrapped)
wrapped - the SimpleXML-deserialized collectionunwrapped - collection to which the original values should be added
public static SimpleXmlWrapperValue wrap(Object value)
public static <T> T unwrap(SimpleXmlWrapperValue value)
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||