1 21 package com.db4o.nativequery.expr.cmp; 22 23 24 public class ConstValue implements ComparisonOperand { 25 private Object _value; 26 27 public ConstValue(Object value) { 28 this._value=value; 29 } 30 31 public Object value() { 32 return _value; 33 } 34 35 public void value(Object value) { 36 _value = value; 37 } 38 39 public String toString() { 40 if (_value == null) return "null"; 41 if (_value instanceof String ) return "\"" + _value + "\""; 42 return _value.toString(); 43 } 44 45 public boolean equals(Object other) { 46 if (this == other) { 47 return true; 48 } 49 if (other==null || getClass() != other.getClass()) { 50 return false; 51 } 52 Object otherValue = ((ConstValue) other)._value; 53 if (otherValue == _value) { 54 return true; 55 } 56 if (otherValue == null || _value == null) { 57 return false; 58 } 59 return _value.equals(otherValue); 60 } 61 62 public int hashCode() { 63 return _value.hashCode(); 64 } 65 66 public void accept(ComparisonOperandVisitor visitor) { 67 visitor.visit(this); 68 } 69 } 70 | Popular Tags |