1 package net.sf.sapjcosupport; 2 3 /** 4 * @author Niki Driessen 5 * @since Jan 23, 2006 - 11:48:36 AM 6 */ 7 public class SapFieldMapping { 8 private String propertyName; 9 private String fieldName; 10 private String type; 11 private String key; 12 private String fullyQualifiedClassName; 13 private boolean notNull; 14 private static final int MAGIC_NUMBER = 29; 15 16 public SapFieldMapping(String propertyName, String fieldName, String type, String fullyQualifiedClassName, boolean notNull) { 17 this(propertyName, fieldName, type, null, fullyQualifiedClassName, notNull); 18 } 19 20 public SapFieldMapping(String propertyName, String fieldName, String type, String key, String fullyQualifiedClassName, boolean notNull) { 21 this.propertyName = propertyName; 22 this.fieldName = fieldName; 23 this.type = type; 24 this.key = key; 25 this.notNull = notNull; 26 this.fullyQualifiedClassName = fullyQualifiedClassName; 27 } 28 29 public String getPropertyName() { 30 return propertyName; 31 } 32 33 public String getFieldName() { 34 return fieldName; 35 } 36 37 public String getType() { 38 return type; 39 } 40 41 public boolean isNotNull() { 42 return notNull; 43 } 44 45 public String getKey() { 46 return key; 47 } 48 49 public boolean equals(Object o) { 50 if (this == o) { 51 return true; 52 } 53 if (o == null || getClass() != o.getClass()) { 54 return false; 55 } 56 final SapFieldMapping that = (SapFieldMapping) o; 57 if (!fieldName.equals(that.fieldName)) { 58 return false; 59 } 60 if (key != null ? !key.equals(that.key) : that.key != null) { 61 return false; 62 } 63 return propertyName.equals(that.propertyName); 64 } 65 66 public int hashCode() { 67 int result; 68 result = propertyName.hashCode(); 69 result = MAGIC_NUMBER * result + fieldName.hashCode(); 70 result = MAGIC_NUMBER * result + (key != null ? key.hashCode() : 0); 71 result = MAGIC_NUMBER * result + (fullyQualifiedClassName != null ? fullyQualifiedClassName.hashCode() : 0); 72 return result; 73 } 74 }