1 package de.fhdw.wtf.persistence.meta;
2
3
4
5
6 public class UnidirectionalLink extends Link {
7
8
9
10
11 private final UnidirectionalAssociation instanceOf;
12
13 @Override
14 public UnidirectionalAssociation getInstanceOf() {
15 return this.instanceOf;
16 }
17
18
19
20
21
22
23
24
25
26
27
28
29
30 public UnidirectionalLink(final long id,
31 final UserObject owner,
32 final Object target,
33 final UnidirectionalAssociation instanceOf) {
34 super(id, owner, target);
35 this.instanceOf = instanceOf;
36 }
37
38 @Override
39 public boolean equals(final java.lang.Object other) {
40 if (!(other instanceof UnidirectionalLink)) {
41 return false;
42 }
43
44 final UnidirectionalLink unidirectionalLink = (UnidirectionalLink) other;
45 return super.equals(unidirectionalLink) && this.getInstanceOf().equals(unidirectionalLink.getInstanceOf());
46 }
47
48 @Override
49 public int hashCode() {
50 return super.hashCode() ^ this.instanceOf.hashCode();
51 }
52 }