Class TransientWrapper

java.lang.Object
com.groiss.util.TransientWrapper

public class TransientWrapper extends Object
Provides a means to exclude serializable objects from serialization mechanisms by wrapping them.
  • Constructor Details

    • TransientWrapper

      public TransientWrapper(Object value)
      Wrap an object.
      Parameters:
      value -
  • Method Details

    • unwrap

      public Object unwrap()
      Unwrap a wrapped object
      Returns:
      the wrapped object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setAttribute

      public static void setAttribute(HttpSession session, String name, Object value)
      Binds an object to a http session, using the name specified. If the object is not instance of TransientWrapper, it is first wrapped into a TransientWrapper.
      Parameters:
      session - a HTTPSession to bind the object to.
      name - the name to which the object is bound; cannot be null
      value - the object to be bound
    • getAttribute

      public static Object getAttribute(HttpSession session, String name)
      Gets the object bound with the specified name from an http session. If the object is an instance of TransientWrapper, the object wrapped by it is returned, else the object itself is returned.
      Parameters:
      session - a HTTPSession where the object is bound
      name - a string specifying the name of the object
      Returns:
      the object with the specified name