1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.model.message;
21
22
23
24
25
26
27
28 public class ExtendedResponseImpl extends AbstractResultResponse implements ExtendedResponse
29 {
30 static final long serialVersionUID = -6646752766410531060L;
31
32
33 protected String responseName;
34
35
36
37
38
39
40
41 public ExtendedResponseImpl( String responseName )
42 {
43 super( -1, TYPE );
44 this.responseName = responseName;
45 }
46
47
48
49
50
51
52
53
54 public ExtendedResponseImpl( final int id, String responseName )
55 {
56 super( id, TYPE );
57 this.responseName = responseName;
58 }
59
60
61
62
63
64
65
66 public ExtendedResponseImpl( int id )
67 {
68 super( id, TYPE );
69 }
70
71
72
73
74
75
76
77
78
79
80
81
82 public String getResponseName()
83 {
84 return ( ( responseName == null ) ? "" : responseName );
85 }
86
87
88
89
90
91
92
93
94 public void setResponseName( String responseName )
95 {
96 this.responseName = responseName;
97 }
98
99
100
101
102
103 @Override
104 public int hashCode()
105 {
106 int hash = 37;
107
108 if ( responseName != null )
109 {
110 hash = hash * 17 + responseName.hashCode();
111 }
112
113 hash = hash * 17 + super.hashCode();
114
115 return hash;
116 }
117
118
119
120
121
122
123
124
125
126 public boolean equals( Object obj )
127 {
128 if ( obj == this )
129 {
130 return true;
131 }
132
133 if ( !super.equals( obj ) )
134 {
135 return false;
136 }
137
138 if ( !( obj instanceof ExtendedResponse ) )
139 {
140 return false;
141 }
142
143 ExtendedResponse resp = ( ExtendedResponse ) obj;
144
145 if ( ( responseName != null ) && ( resp.getResponseName() == null ) )
146 {
147 return false;
148 }
149
150 if ( ( responseName == null ) && ( resp.getResponseName() != null ) )
151 {
152 return false;
153 }
154
155 if ( ( responseName != null ) && ( resp.getResponseName() != null )
156 && !responseName.equals( resp.getResponseName() ) )
157 {
158 return false;
159 }
160
161 return true;
162 }
163
164
165
166
167
168
169
170 public String toString()
171 {
172 StringBuilder sb = new StringBuilder();
173
174 sb.append( " Extended Response\n" );
175
176 if ( responseName != null )
177 {
178 sb.append( " ResponseName :'" ).append( responseName ).append( "'\n" );
179 }
180
181 sb.append( super.toString() );
182
183 return super.toString( sb.toString() );
184 }
185 }