org.apache.commons.lang.mutable
Class MutableObject

java.lang.Object
  extended byorg.apache.commons.lang.mutable.MutableObject
All Implemented Interfaces:
Mutable, java.io.Serializable

public class MutableObject
extends java.lang.Object
implements Mutable, java.io.Serializable

A mutable Object wrapper.

Since:
2.1
Version:
$Id: MutableObject.java 437554 2006-08-28 06:21:41Z bayard $
See Also:
Serialized Form

Constructor Summary
MutableObject()
          Constructs a new MutableObject with the default value of null.
MutableObject(java.lang.Object value)
          Constructs a new MutableObject with the specified value.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Compares this object against the specified object.
 java.lang.Object getValue()
          Gets the value.
 int hashCode()
          Returns the value's hash code or 0 if the value is null.
 void setValue(java.lang.Object value)
          Sets the value.
 java.lang.String toString()
          Returns the String value of this mutable.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MutableObject

public MutableObject()
Constructs a new MutableObject with the default value of null.


MutableObject

public MutableObject(java.lang.Object value)
Constructs a new MutableObject with the specified value.

Parameters:
value - a value.
Method Detail

getValue

public java.lang.Object getValue()
Gets the value.

Specified by:
getValue in interface Mutable
Returns:
the value

setValue

public void setValue(java.lang.Object value)
Sets the value.

Specified by:
setValue in interface Mutable
Parameters:
value - the value to set

equals

public boolean equals(java.lang.Object obj)
Compares this object against the specified object. The result is true if and only if the argument is not null and is a MutableObject object that contains the same Object value as this object.

Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Returns the value's hash code or 0 if the value is null.

Returns:
the value's hash code or 0 if the value is null.

toString

public java.lang.String toString()
Returns the String value of this mutable.

Returns:
the mutable value as a string


Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.