1 package org.apache.torque.generator.configuration.mergepoint;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.ArrayList;
23 import java.util.List;
24
25 import org.apache.torque.generator.control.action.MergepointAction;
26
27
28
29
30
31 public class MergepointMapping
32 {
33
34
35
36 private String name;
37
38
39
40
41 private List<MergepointAction> actions = new ArrayList<MergepointAction>();
42
43
44
45
46
47
48
49
50 public MergepointMapping(String name)
51 {
52 if (name == null)
53 {
54 throw new IllegalArgumentException("name must not be null");
55 }
56 this.name = name;
57 }
58
59
60
61
62
63
64
65
66
67 public MergepointMapping(String name, List<MergepointAction> actions)
68 {
69 this(name);
70 this.actions.addAll(actions);
71 }
72
73
74
75
76
77
78 public String getName()
79 {
80 return name;
81 }
82
83
84
85
86
87
88 public List<MergepointAction> getActions()
89 {
90 return actions;
91 }
92
93
94
95
96
97
98
99
100 public void addAction(MergepointAction action)
101 {
102 if (action == null)
103 {
104 throw new NullPointerException("action is null");
105 }
106 this.actions.add(action);
107 }
108
109 @Override
110 public String toString()
111 {
112 StringBuffer result = new StringBuffer();
113 result.append("(name=").append(name)
114 .append(",actions=").append(actions)
115 .append(")");
116 return result.toString();
117 }
118
119 @Override
120 public int hashCode()
121 {
122 final int prime = 31;
123 int result = 1;
124 result = prime * result + ((actions == null) ? 0 : actions.hashCode());
125 result = prime * result + ((name == null) ? 0 : name.hashCode());
126 return result;
127 }
128
129 @Override
130 public boolean equals(Object obj)
131 {
132 if (this == obj)
133 {
134 return true;
135 }
136 if (obj == null)
137 {
138 return false;
139 }
140 if (getClass() != obj.getClass())
141 {
142 return false;
143 }
144 final MergepointMapping other = (MergepointMapping) obj;
145 if (actions == null)
146 {
147 if (other.actions != null)
148 {
149 return false;
150 }
151 }
152 else if (!actions.equals(other.actions))
153 {
154 return false;
155 }
156 if (name == null)
157 {
158 if (other.name != null)
159 {
160 return false;
161 }
162 }
163 else if (!name.equals(other.name))
164 {
165 return false;
166 }
167 return true;
168 }
169 }