Class SortRequestDecorator
- java.lang.Object
-
- org.apache.directory.api.ldap.codec.api.ControlDecorator<SortRequest>
-
- org.apache.directory.api.ldap.codec.controls.sort.SortRequestDecorator
-
- All Implemented Interfaces:
Asn1Object
,CodecControl<SortRequest>
,Decorator<SortRequest>
,Control
,SortRequest
public class SortRequestDecorator extends ControlDecorator<SortRequest> implements SortRequest
Decorator of SortRequestControl.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description static int
ORDERING_RULE_TAG
ASN.1 BER tag for the forward ordering rulestatic int
REVERSE_ORDER_TAG
ASN.1 BER tag for the backward ordering rule-
Fields inherited from interface org.apache.directory.api.ldap.model.message.controls.SortRequest
OID
-
-
Constructor Summary
Constructors Constructor Description SortRequestDecorator(LdapApiService codec)
Creates a new instance of SortRequestDecorator.SortRequestDecorator(LdapApiService codec, SortRequest control)
Creates a new instance of SortRequestDecorator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSortKey(SortKey sortKey)
adds a sort keyint
computeLength()
Compute the object length, which is the sum of all inner length.Asn1Object
decode(byte[] controlBytes)
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.ByteBuffer
encode(ByteBuffer buffer)
Encode the object to a PDU.List<SortKey>
getSortKeys()
byte[]
getValue()
Get the control valuevoid
setSortKeys(List<SortKey> sortKeys)
sets the sort keys-
Methods inherited from class org.apache.directory.api.ldap.codec.api.ControlDecorator
equals, getCodecService, getDecorated, getOid, hashCode, hasValue, isCritical, setCritical, setDecorated, setValue, toString
-
Methods inherited from interface org.apache.directory.api.ldap.model.message.Control
getOid, isCritical, setCritical
-
-
-
-
Field Detail
-
ORDERING_RULE_TAG
public static final int ORDERING_RULE_TAG
ASN.1 BER tag for the forward ordering rule- See Also:
- Constant Field Values
-
REVERSE_ORDER_TAG
public static final int REVERSE_ORDER_TAG
ASN.1 BER tag for the backward ordering rule- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SortRequestDecorator
public SortRequestDecorator(LdapApiService codec)
Creates a new instance of SortRequestDecorator.- Parameters:
codec
- the LDAP codec
-
SortRequestDecorator
public SortRequestDecorator(LdapApiService codec, SortRequest control)
Creates a new instance of SortRequestDecorator.- Parameters:
codec
- the LDAP codeccontrol
- the control instance
-
-
Method Detail
-
computeLength
public int computeLength()
Description copied from interface:Asn1Object
Compute the object length, which is the sum of all inner length.- Specified by:
computeLength
in interfaceAsn1Object
- Returns:
- the control length.
-
encode
public ByteBuffer encode(ByteBuffer buffer) throws EncoderException
Encode the object to a PDU.- Specified by:
encode
in interfaceAsn1Object
- Parameters:
buffer
- The buffer where to put the PDU- Returns:
- The encoded PDU.
- Throws:
EncoderException
- if the buffer can't be encoded
-
decode
public Asn1Object decode(byte[] controlBytes) throws DecoderException
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.- Specified by:
decode
in interfaceCodecControl<SortRequest>
- Parameters:
controlBytes
- the encoded control bytes- Returns:
- the decoded Asn1Object for the control
- Throws:
DecoderException
- if anything goes wrong
-
getValue
public byte[] getValue()
Get the control value- Specified by:
getValue
in interfaceCodecControl<SortRequest>
- Overrides:
getValue
in classControlDecorator<SortRequest>
- Returns:
- The control value
-
setSortKeys
public void setSortKeys(List<SortKey> sortKeys)
sets the sort keys- Specified by:
setSortKeys
in interfaceSortRequest
- Parameters:
sortKeys
- The list of keys to be sorted
-
getSortKeys
public List<SortKey> getSortKeys()
- Specified by:
getSortKeys
in interfaceSortRequest
- Returns:
- the list of sort keys
-
addSortKey
public void addSortKey(SortKey sortKey)
adds a sort key- Specified by:
addSortKey
in interfaceSortRequest
- Parameters:
sortKey
- The list of keys to be sorted
-
-