Package org.apache.commons.lang.mutable
Class MutableObject
- java.lang.Object
-
- org.apache.commons.lang.mutable.MutableObject
-
- All Implemented Interfaces:
java.io.Serializable,Mutable
public class MutableObject extends java.lang.Object implements Mutable, java.io.Serializable
A mutableObjectwrapper.- Since:
- 2.1
- Version:
- $Id: MutableObject.java 905636 2010-02-02 14:03:32Z niallp $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDRequired for serialization support.private java.lang.ObjectvalueThe mutable value.
-
Constructor Summary
Constructors Constructor Description MutableObject()Constructs a new MutableObject with the default value ofnull.MutableObject(java.lang.Object value)Constructs a new MutableObject with the specified value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Compares this object against the specified object.java.lang.ObjectgetValue()Gets the value.inthashCode()Returns the value's hash code or0if the value isnull.voidsetValue(java.lang.Object value)Sets the value.java.lang.StringtoString()Returns the String value of this mutable.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Required for serialization support.- See Also:
Serializable, Constant Field Values
-
value
private java.lang.Object value
The mutable value.
-
-
Method Detail
-
getValue
public java.lang.Object getValue()
Gets the value.
-
setValue
public void setValue(java.lang.Object value)
Sets the value.
-
equals
public boolean equals(java.lang.Object obj)
Compares this object against the specified object. The result istrueif and only if the argument is notnulland is aMutableObjectobject that contains the sameObjectvalue as this object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare with, null returns false- Returns:
trueif the objects are the same;falseotherwise.
-
hashCode
public int hashCode()
Returns the value's hash code or0if the value isnull.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the value's hash code or
0if the value isnull.
-
toString
public java.lang.String toString()
Returns the String value of this mutable.- Overrides:
toStringin classjava.lang.Object- Returns:
- the mutable value as a string
-
-