Package org.apache.juneau.marshall.swaps
Class MarshallingStringSwap<T>
java.lang.Object
org.apache.juneau.marshall.swap.spi.ObjectSwap<T,String>
org.apache.juneau.marshall.swap.spi.StringSwap<T>
org.apache.juneau.marshall.swaps.MarshallingStringSwap<T>
- Type Parameters:
T- The class type of the bean.
Transforms beans into
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 MarshallingContext (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 POJO Categories.
See Also:
-
Field Summary
Fields inherited from class org.apache.juneau.marshall.swap.spi.ObjectSwap
NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionswap(MarshallingSession session, T o) Converts the specified bean to aString.Methods inherited from class org.apache.juneau.marshall.swap.spi.ObjectSwap
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, unswap, withTemplate, withTemplate
-
Constructor Details
-
MarshallingStringSwap
public MarshallingStringSwap()
-
-
Method Details
-
swap
Converts the specified bean to aString.- Overrides:
swapin classObjectSwap<T,String> - Parameters:
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.- Returns:
- The transformed object.
-