Class MarshallingStringSwap<T>

Type Parameters:
T - The class type of the bean.

public class MarshallingStringSwap<T> extends StringSwap<T>
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:
  • Constructor Details

  • Method Details

    • swap

      public String swap(MarshallingSession session, T o)
      Converts the specified bean to a String.
      Overrides:
      swap in class ObjectSwap<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.