T
- The normal class type.public class AutoMapSwap<T> extends PojoSwap<T,Map<?,?>>
Looks for methods on the class that can be called to swap-in surrogate Map objects before serialization and swap-out surrogate Map objects after parsing.
Map
Classes are ignored if any of the following are true:
@BeanIgnore
.
Members/constructors are ignored if any of the following are true:
@BeanIgnore
.
Modifier and Type | Method and Description |
---|---|
static PojoSwap<?,?> |
find(ClassInfo ci)
Look for constructors and methods on this class and construct a dynamic swap if it's possible to do so.
|
Map<?,?> |
swap(BeanSession session,
Object o)
If this transform is to be used to serialize non-serializable POJOs, it must implement this method.
|
T |
unswap(BeanSession session,
Map<?,?> o,
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, withTemplate
public static PojoSwap<?,?> find(ClassInfo ci)
ci
- The class to try to constructor a dynamic swap on.public Map<?,?> swap(BeanSession session, Object o) throws SerializeException
PojoSwap
The 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,Map<?,?>>
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.SerializeException
public T unswap(BeanSession session, Map<?,?> o, ClassMeta<?> hint) throws ParseException
PojoSwap
unswap
in class PojoSwap<T,Map<?,?>>
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 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
.
ParseException
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.