1 | package genius.core.repository;
|
---|
2 |
|
---|
3 | import javax.xml.bind.annotation.XmlAttribute;
|
---|
4 | import javax.xml.bind.annotation.XmlRootElement;
|
---|
5 |
|
---|
6 | @XmlRootElement
|
---|
7 | public class ProtocolRepItem implements RepItem {
|
---|
8 |
|
---|
9 | @XmlAttribute
|
---|
10 | String protocolName;
|
---|
11 | /** the key: short but unique name of the protocol as it will be known in the nego system.
|
---|
12 | * This is an arbitrary but unique label for this protocol. */
|
---|
13 | @XmlAttribute
|
---|
14 | String classPath; /** file path including the class name */
|
---|
15 | @XmlAttribute
|
---|
16 | String description; /** description of this agent */
|
---|
17 |
|
---|
18 | public ProtocolRepItem() {
|
---|
19 |
|
---|
20 | }
|
---|
21 |
|
---|
22 |
|
---|
23 |
|
---|
24 | public ProtocolRepItem(String protocolName, String classPath,
|
---|
25 | String description) {
|
---|
26 | super();
|
---|
27 | this.protocolName = protocolName;
|
---|
28 | this.classPath = classPath;
|
---|
29 | this.description = description;
|
---|
30 | }
|
---|
31 | @Override
|
---|
32 | public int hashCode() {
|
---|
33 | final int prime = 31;
|
---|
34 | int result = 1;
|
---|
35 | result = prime * result
|
---|
36 | + ((classPath == null) ? 0 : classPath.hashCode());
|
---|
37 | result = prime * result
|
---|
38 | + ((description == null) ? 0 : description.hashCode());
|
---|
39 | result = prime * result
|
---|
40 | + ((protocolName == null) ? 0 : protocolName.hashCode());
|
---|
41 | return result;
|
---|
42 | }
|
---|
43 | @Override
|
---|
44 | public boolean equals(Object obj) {
|
---|
45 | if (this == obj)
|
---|
46 | return true;
|
---|
47 | if (obj == null)
|
---|
48 | return false;
|
---|
49 | if (getClass() != obj.getClass())
|
---|
50 | return false;
|
---|
51 | ProtocolRepItem other = (ProtocolRepItem) obj;
|
---|
52 | if (classPath == null) {
|
---|
53 | if (other.classPath != null)
|
---|
54 | return false;
|
---|
55 | } else if (!classPath.equals(other.classPath))
|
---|
56 | return false;
|
---|
57 | if (description == null) {
|
---|
58 | if (other.description != null)
|
---|
59 | return false;
|
---|
60 | } else if (!description.equals(other.description))
|
---|
61 | return false;
|
---|
62 | if (protocolName == null) {
|
---|
63 | if (other.protocolName != null)
|
---|
64 | return false;
|
---|
65 | } else if (!protocolName.equals(other.protocolName))
|
---|
66 | return false;
|
---|
67 | return true;
|
---|
68 | }
|
---|
69 | /** Getters and Setters **/
|
---|
70 | public String getName() {
|
---|
71 | return protocolName;
|
---|
72 | }
|
---|
73 |
|
---|
74 | public String getClassPath() {
|
---|
75 | return classPath;
|
---|
76 | }
|
---|
77 |
|
---|
78 | public String getDescription() {
|
---|
79 | return description;
|
---|
80 | }
|
---|
81 | }
|
---|