1 16 17 package org.apache.commons.lang.mutable; 18 19 import java.io.Serializable ; 20 21 27 public class MutableObject implements Mutable, Serializable { 28 29 30 private static final long serialVersionUID = 86241875189L; 31 32 33 private Object value; 34 35 38 public MutableObject() { 39 super(); 40 } 41 42 48 public MutableObject(Object value) { 49 super(); 50 this.value = value; 51 } 52 53 59 public Object getValue() { 60 return this.value; 61 } 62 63 69 public void setValue(Object value) { 70 this.value = value; 71 } 72 73 83 public boolean equals(Object obj) { 84 if (obj instanceof MutableObject) { 85 Object other = ((MutableObject) obj).value; 86 return value == other || (value != null && value.equals(other)); 87 } 88 return false; 89 } 90 91 96 public int hashCode() { 97 return value == null ? 0 : value.hashCode(); 98 } 99 100 105 public String toString() { 106 return value == null ? "null" : value.toString(); 107 } 108 109 } 110 | Popular Tags |