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 public SortResponseControlImpl()
36 {
37 super( OID );
38 }
39
40 @Override
41 public void setSortResult( SortResultCode result )
42 {
43 this.result = result;
44 }
45
46 @Override
47 public SortResultCode getSortResult()
48 {
49 return result;
50 }
51
52 @Override
53 public void setAttributeName( String attributeName )
54 {
55 this.attributeName = attributeName;
56 }
57
58 @Override
59 public String getAttributeName()
60 {
61 return attributeName;
62 }
63
64 @Override
65 public int hashCode()
66 {
67 final int prime = 31;
68 int result = super.hashCode();
69 result = prime * result + ( ( attributeName == null ) ? 0 : attributeName.hashCode() );
70 result = prime * result + ( ( this.result == null ) ? 0 : this.result.hashCode() );
71 return result;
72 }
73
74 @Override
75 public boolean equals( Object o )
76 {
77 if( !super.equals( o ) )
78 {
79 return false;
80 }
81
82 SortResponse that = ( SortResponse ) o;
83
84 if( result != that.getSortResult() )
85 {
86 return false;
87 }
88
89 if( attributeName != null )
90 {
91 return ( attributeName.equalsIgnoreCase( that.getAttributeName() ) );
92 }
93 else if( that.getAttributeName() == null )
94 {
95 return true;
96 }
97
98 return false;
99 }
100
101 @Override
102 public String toString()
103 {
104 return "SortResponseControlImpl [result=" + result + ", attributeName=" + attributeName + "]";
105 }
106
107 }