1 22 package org.jboss.reflect.spi; 23 24 import java.io.Serializable ; 25 26 import org.jboss.util.JBossObject; 27 28 34 public class PrimitiveValue extends JBossObject implements Serializable , Value 35 { 36 37 private static final long serialVersionUID = 3907214866304741945L; 38 39 40 protected String value; 41 42 43 protected PrimitiveInfo type; 44 45 48 public PrimitiveValue() 49 { 50 } 51 52 58 public PrimitiveValue(String value, PrimitiveInfo type) 59 { 60 this.value = value; 61 this.type = type; 62 } 63 64 69 public String getValue() 70 { 71 return value; 72 } 73 74 public TypeInfo getType() 75 { 76 return type; 77 } 78 79 public boolean equals(Object o) 80 { 81 if (this == o) return true; 82 if (!(o instanceof PrimitiveValue)) return false; 83 84 final PrimitiveValue primitiveValue = (PrimitiveValue) o; 85 86 if (!type.equals(primitiveValue.type)) return false; 87 if (!value.equals(primitiveValue.value)) return false; 88 89 return true; 90 } 91 92 public int hashCode() 93 { 94 int result; 95 result = (value != null) ? value.hashCode() : 0; 96 result = 29 * result + type.hashCode(); 97 return result; 98 } 99 } 100 | Popular Tags |