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