Class BeanStringSwap<T>

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

public class BeanStringSwap<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 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 parsable POJO.

See Also:
  • Constructor Details

  • Method Details

    • swap

      public String swap(BeanSession session, T o)
      Converts the specified bean to a 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.
      The transformed object.