Package com.groiss.util
Class TransientWrapper
java.lang.Object
com.groiss.util.TransientWrapper
Provides a means to exclude serializable objects from serialization mechanisms by wrapping them.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Object
getAttribute
(HttpSession session, String name) Gets the object bound with the specified name from an http session.static void
setAttribute
(HttpSession session, String name, Object value) Binds an object to a http session, using the name specified.toString()
unwrap()
Unwrap a wrapped object
-
Constructor Details
-
TransientWrapper
Wrap an object.- Parameters:
value
-
-
-
Method Details
-
unwrap
Unwrap a wrapped object- Returns:
- the wrapped object
-
toString
-
setAttribute
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 nullvalue
- the object to be bound
-
getAttribute
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 boundname
- a string specifying the name of the object- Returns:
- the object with the specified name
-