T
- The class type of the bean.public class BeanStringSwap<T> extends StringSwap<T>
Strings
by simply calling the Object.toString()
method.
Allows you to specify classes that should just be converted to Strings
instead of potentially
being turned into Maps by the BeanContext
(or worse, throwing
BeanRuntimeExceptions
).
This is usually a one-way transform. Beans serialized as strings cannot be reconstituted using a parser unless it is a Type 5 POJO.
Constructor and Description |
---|
BeanStringSwap() |
Modifier and Type | Method and Description |
---|---|
String |
swap(BeanSession session,
T o)
Converts the specified bean to a
String . |
unswap
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, withTemplate, withTemplate
public BeanStringSwap()
public String swap(BeanSession session, T o)
String
.swap
in class StringSwap<T>
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.Copyright © 2018 Apache. All rights reserved.