1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.sequencing; 23 24 import javax.persistence.SequenceGenerator; 25 26 33 public class MetadataSequenceGenerator extends MetadataGenerator { 34 private SequenceGenerator m_sequenceGenerator; 35 36 39 protected MetadataSequenceGenerator(String entityClassName) { 40 super(entityClassName); 41 } 42 43 46 public MetadataSequenceGenerator(SequenceGenerator sequenceGenerator, String entityClassName) { 47 super(entityClassName); 48 m_sequenceGenerator = sequenceGenerator; 49 } 50 51 54 public boolean equals(Object objectToCompare) { 55 if (objectToCompare instanceof MetadataSequenceGenerator) { 56 MetadataSequenceGenerator generator = (MetadataSequenceGenerator) objectToCompare; 57 58 if (!generator.getName().equals(getName())) { 59 return false; 60 } 61 62 if (generator.getInitialValue() != getInitialValue()) { 63 return false; 64 } 65 66 if (generator.getAllocationSize() != getAllocationSize()) { 67 return false; 68 } 69 70 return generator.getSequenceName().equals(getSequenceName()); 71 } 72 73 return false; 74 } 75 76 79 public int getAllocationSize() { 80 return m_sequenceGenerator.allocationSize(); 81 } 82 83 86 public int getInitialValue() { 87 return m_sequenceGenerator.initialValue(); 88 } 89 90 93 public String getName() { 94 return m_sequenceGenerator.name(); 95 } 96 97 100 public String getSequenceName() { 101 return m_sequenceGenerator.sequenceName(); 102 } 103 } 104 | Popular Tags |