01: package org.netbeans.modules.xml.wsdl.model.extensions.soap.validation;
02:
03: import org.netbeans.modules.xml.wsdl.model.Message;
04:
05: public class MessagePart {
06:
07: private final String messageName;
08: private final String partName;
09: private final int hashCode;
10:
11: public MessagePart(Message message, String partName) {
12: if (message == null) {
13: throw new NullPointerException("null messageName");
14: }
15: if (partName == null) {
16: throw new NullPointerException("null partName");
17: }
18: if ("".equals(partName)) {
19: throw new IllegalArgumentException("blank partName");
20: }
21:
22: messageName = message.getName();
23: this .partName = partName;
24: hashCode = messageName.toString().concat(partName).hashCode();
25: }
26:
27: @Override
28: public boolean equals(Object other) {
29: if (other == this ) {
30: return true;
31: }
32: if (other == null || !(other instanceof MessagePart)) {
33: return false;
34: }
35:
36: MessagePart that = (MessagePart) other;
37: if (!messageName.equals(that.messageName)) {
38: return false;
39: }
40:
41: return partName.equals(that.partName);
42: }
43:
44: @Override
45: public int hashCode() {
46: return hashCode;
47: }
48: }
|