Class Box<T>
java.lang.Object
com.saperion.common.lang.encapsulation.Box<T>
- Type Parameters:
T
- Type of the boxed object
- All Implemented Interfaces:
Serializable
Helper class to box an object. Main purpose is to create an easy standard way for call-by-reference method parameters.
The box-parameters should be the last parameters of a method by convention to increase readability.
This implementation is not synchronized. If used by different threads concurrently, external synchronization is necessary.
- Author:
- agz
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Box
Create a box with the specified object as its content.- Parameters:
object
- object to box
-
Box
public Box()Creates a box with anull
content.
-
-
Method Details
-
set
Set the specified object as the new content of this box.- Parameters:
object
- new content
-
get
Returns the boxed object.- Returns:
- the current content of the box
-
equals
-
hashCode
public int hashCode() -
toString
-