mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
03.26.2009 e10a19e91d09aa4bf4dd1fabf048b46299899e35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package org.opends.sdk.controls;
 
 
 
import org.opends.sdk.AttributeDescription;
import org.opends.sdk.util.Validator;
 
 
 
/**
 * This class defines a data structure that may be used as a sort key.
 * It includes an attribute description and a boolean value that
 * indicates whether the sort should be ascending or descending. It may
 * also contain a specific ordering matching rule that should be used
 * for the sorting process, although if none is provided it will use the
 * default ordering matching rule for the attribute type.
 */
public class SortKey
{
  private String attributeDescription;
 
  private String orderingRule;
 
  boolean reverseOrder;
 
 
 
  public SortKey(AttributeDescription attributeDescription)
  {
    this(attributeDescription.toString(), null, false);
  }
 
 
 
  public SortKey(AttributeDescription attributeDescription,
      String orderingRule)
  {
    this(attributeDescription.toString(), orderingRule, false);
  }
 
 
 
  public SortKey(AttributeDescription attributeDescription,
      String orderingRule, boolean reverseOrder)
  {
    this(attributeDescription.toString(), orderingRule, reverseOrder);
  }
 
 
 
  public SortKey(String attributeDescription)
  {
    this(attributeDescription, null, false);
  }
 
 
 
  public SortKey(String attributeDescription, String orderingRule)
  {
    this(attributeDescription, orderingRule, false);
  }
 
 
 
  public SortKey(String attributeDescription, String orderingRule,
      boolean reverseOrder)
  {
    Validator.ensureNotNull(attributeDescription);
    this.attributeDescription = attributeDescription;
    this.orderingRule = orderingRule;
    this.reverseOrder = reverseOrder;
  }
 
 
 
  public String getAttributeDescription()
  {
    return attributeDescription;
  }
 
 
 
  public String getOrderingRule()
  {
    return orderingRule;
  }
 
 
 
  public boolean isReverseOrder()
  {
    return reverseOrder;
  }
 
 
 
  public SortKey setAttributeDescription(String attributeDescription)
  {
    Validator.ensureNotNull(attributeDescription);
    this.attributeDescription = attributeDescription;
    return this;
  }
 
 
 
  public SortKey setOrderingRule(String orderingRule)
  {
    this.orderingRule = orderingRule;
    return this;
  }
 
 
 
  public void setReverseOrder(boolean reverseOrder)
  {
    this.reverseOrder = reverseOrder;
  }
 
 
 
  /**
   * {@inheritDoc}
   */
  @Override
  public String toString()
  {
    StringBuilder buffer = new StringBuilder();
    toString(buffer);
    return buffer.toString();
  }
 
 
 
  public void toString(StringBuilder buffer)
  {
    buffer.append("SortKey(attributeDescription=");
    buffer.append(attributeDescription);
    buffer.append(", orderingRule=");
    buffer.append(orderingRule);
    buffer.append(", reverseOrder=");
    buffer.append(reverseOrder);
    buffer.append(")");
  }
}