T - The normal form of the class.public abstract class StringSwap<T> extends PojoSwap<T,String>
| Modifier | Constructor and Description |
|---|---|
protected |
StringSwap()
Constructor.
|
protected |
StringSwap(Class<T> normalClass)
Constructor for when the normal and transformed classes are already known.
|
| Modifier and Type | Method and Description |
|---|---|
String |
swap(BeanSession session,
T o)
If this transform is to be used to serialize non-serializable POJOs, it must implement this method.
|
T |
unswap(BeanSession session,
String f,
ClassMeta<?> hint)
If this transform is to be used to reconstitute POJOs that aren't true Java beans, it must implement this method.
|
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, withTemplate, withTemplateprotected StringSwap()
protected StringSwap(Class<T> normalClass)
normalClass - The normal class (cannot be serialized).public String swap(BeanSession session, T o) throws Exception
PojoSwapThe object must be converted into one of the following serializable types:
String
Number
Boolean
Collection containing anything on this list.
Map containing anything on this list.
swap in class PojoSwap<T,String>session - The bean session to use to get the class meta.
This is always going to be the same bean context that created this swap.o - The object to be transformed.Exception - If a problem occurred trying to convert the output.public T unswap(BeanSession session, String f, ClassMeta<?> hint) throws Exception
PojoSwapunswap in class PojoSwap<T,String>session - The bean session to use to get the class meta.
This is always going to be the same bean context that created this swap.f - The transformed object.hint - If possible, the parser will try to tell you the object type being created.
For example, on a serialized date, this may tell you that the object being created must be of type
GregorianCalendar.
Exception - If this method is not implemented.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.