public class SimpleXmlWrappers extends Object
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 and Description |
---|
SimpleXmlWrappers() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
addWrapper(Class<T> wrappedClass,
Class<? extends ISimpleXmlWrapper<? super T>> wrapperClass)
Registers a new
ISimpleXmlWrapper . |
static <T> void |
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 <K> Map<K,Object> |
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 <T> T |
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 <K> Map<K,SimpleXmlWrapperValue> |
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.
|
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 wrappedClass
addWrapper(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 wrappedClass
strict
- 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 addedpublic static Collection<Object> unwrap(Collection<SimpleXmlWrapperValue> wrapped, Collection<Object> unwrapped)
wrapped
- the SimpleXML-deserialized collectionunwrapped
- collection to which the original values should be addedpublic static SimpleXmlWrapperValue wrap(Object value)
public static <T> T unwrap(SimpleXmlWrapperValue value)