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.controls;
21
22
23
24
25
26
27 public class SortResponseControlImpl extends AbstractControl implements SortResponse
28 {
29
30 private SortResultCode result;
31
32
33 private String attributeName;
34
35
36
37
38 public SortResponseControlImpl()
39 {
40 super( OID );
41 }
42
43
44
45
46 @Override
47 public void setSortResult( SortResultCode result )
48 {
49 this.result = result;
50 }
51
52
53
54
55 @Override
56 public SortResultCode getSortResult()
57 {
58 return result;
59 }
60
61
62
63
64 @Override
65 public void setAttributeName( String attributeName )
66 {
67 this.attributeName = attributeName;
68 }
69
70
71
72
73 @Override
74 public String getAttributeName()
75 {
76 return attributeName;
77 }
78
79
80
81
82 @Override
83 public int hashCode()
84 {
85 final int prime = 31;
86 int hash = super.hashCode();
87 hash = prime * hash + ( ( attributeName == null ) ? 0 : attributeName.hashCode() );
88 hash = prime * hash + ( ( this.result == null ) ? 0 : this.result.hashCode() );
89
90 return hash;
91 }
92
93
94
95
96 @Override
97 public boolean equals( Object o )
98 {
99 if ( !super.equals( o ) )
100 {
101 return false;
102 }
103
104 SortResponse that = ( SortResponse ) o;
105
106 if ( result != that.getSortResult() )
107 {
108 return false;
109 }
110
111 if ( attributeName != null )
112 {
113 return attributeName.equalsIgnoreCase( that.getAttributeName() );
114 }
115 else if ( that.getAttributeName() == null )
116 {
117 return true;
118 }
119
120 return false;
121 }
122
123
124
125
126 @Override
127 public String toString()
128 {
129 return "SortResponseControlImpl [result=" + result + ", attributeName=" + attributeName + "]";
130 }
131
132 }