1 22 package org.jboss.ejb.plugins.cmp.jdbc; 23 24 import org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMRFieldBridge; 25 26 32 public final class RelationPair { 33 private final JDBCCMRFieldBridge leftCMRField; 34 private final JDBCCMRFieldBridge rightCMRField; 35 36 private final Object leftId; 37 private final Object rightId; 38 39 public RelationPair( 40 JDBCCMRFieldBridge leftCMRField, Object leftId, 41 JDBCCMRFieldBridge rightCMRField, Object rightId) { 42 43 this.leftCMRField = leftCMRField; 44 this.leftId = leftId; 45 46 this.rightCMRField = rightCMRField; 47 this.rightId = rightId; 48 } 49 50 public Object getLeftId() { 51 return leftId; 52 } 53 54 public Object getRightId() { 55 return rightId; 56 } 57 58 public boolean equals(Object obj) { 59 if(obj instanceof RelationPair) { 60 RelationPair pair = (RelationPair) obj; 61 62 if(leftCMRField == pair.leftCMRField && 64 rightCMRField == pair.rightCMRField && 65 leftId.equals(pair.leftId) && 66 rightId.equals(pair.rightId)) { 67 return true; 68 } 69 70 if(leftCMRField == pair.rightCMRField && 72 rightCMRField == pair.leftCMRField && 73 leftId.equals(pair.rightId) && 74 rightId.equals(pair.leftId)) { 75 return true; 76 } 77 } 78 return false; 79 } 80 81 public int hashCode() { 82 return leftId.hashCode() ^ rightId.hashCode(); 83 } 84 } 85 86 | Popular Tags |