1 8 9 package com.sleepycat.persist.model; 10 11 12 22 public class SecondaryKeyMetadata extends FieldMetadata { 23 24 private static final long serialVersionUID = 8118924993396722502L; 25 26 private String keyName; 27 private Relationship relationship; 28 private String elementClassName; 29 private String relatedEntity; 30 private DeleteAction deleteAction; 31 32 35 public SecondaryKeyMetadata(String name, 36 String className, 37 String declaringClassName, 38 String elementClassName, 39 String keyName, 40 Relationship relationship, 41 String relatedEntity, 42 DeleteAction deleteAction) { 43 super(name, className, declaringClassName); 44 this.elementClassName = elementClassName; 45 this.keyName = keyName; 46 this.relationship = relationship; 47 this.relatedEntity = relatedEntity; 48 this.deleteAction = deleteAction; 49 } 50 51 58 public String getElementClassName() { 59 return elementClassName; 60 } 61 62 65 public String getKeyName() { 66 return keyName; 67 } 68 69 74 public Relationship getRelationship() { 75 return relationship; 76 } 77 78 83 public String getRelatedEntity() { 84 return relatedEntity; 85 } 86 87 93 public DeleteAction getDeleteAction() { 94 return deleteAction; 95 } 96 97 @Override 98 public boolean equals(Object other) { 99 if (other instanceof SecondaryKeyMetadata) { 100 SecondaryKeyMetadata o = (SecondaryKeyMetadata) other; 101 return super.equals(o) && 102 relationship == o.relationship && 103 deleteAction == o.deleteAction && 104 ClassMetadata.nullOrEqual(keyName, o.keyName) && 105 ClassMetadata.nullOrEqual(elementClassName, 106 o.elementClassName) && 107 ClassMetadata.nullOrEqual(relatedEntity, o.relatedEntity); 108 } else { 109 return false; 110 } 111 } 112 113 @Override 114 public int hashCode() { 115 return super.hashCode() + 116 relationship.hashCode() + 117 deleteAction.hashCode() + 118 ClassMetadata.hashCode(keyName) + 119 ClassMetadata.hashCode(elementClassName) + 120 ClassMetadata.hashCode(relatedEntity); 121 } 122 } 123 | Popular Tags |