1 22 package org.jboss.test.cmp2.enums.ejb; 23 24 import org.jboss.ejb.plugins.cmp.jdbc.Mapper; 25 26 import java.io.Serializable ; 27 28 32 public class IDClass 33 implements Serializable , Mapper 34 { 35 public long id; 36 37 public IDClass() 38 { 39 } 40 41 public IDClass(long id) 42 { 43 this.id = id; 44 } 45 46 public long getId() 47 { 48 return id; 49 } 50 51 public void setId(long id) 52 { 53 this.id = id; 54 } 55 56 public boolean equals(Object o) 57 { 58 if(this == o) return true; 59 if(!(o instanceof IDClass)) return false; 60 61 final IDClass idClass = (IDClass) o; 62 63 if(id != idClass.id) return false; 64 65 return true; 66 } 67 68 public int hashCode() 69 { 70 return (int) (id ^ (id >>> 32)); 71 } 72 73 public String toString() 74 { 75 return "[" + id + ']'; 76 } 77 78 80 public Object toColumnValue(Object fieldValue) 81 { 82 return fieldValue == null ? null : new Long (((IDClass)fieldValue).id); 83 } 84 85 public Object toFieldValue(Object columnValue) 86 { 87 return columnValue == null ? null : new IDClass(((Long )columnValue).longValue()); 88 } 89 } 90 | Popular Tags |