org.apache.directory.api.ldap.codec.controls.search.subentries
Class SubentriesDecorator

java.lang.Object
  extended by org.apache.directory.api.asn1.AbstractAsn1Object
      extended by org.apache.directory.api.ldap.codec.api.ControlDecorator<Subentries>
          extended by org.apache.directory.api.ldap.codec.controls.search.subentries.SubentriesDecorator
All Implemented Interfaces:
Asn1Object, CodecControl<Subentries>, Decorator<Subentries>, Control, Subentries

public class SubentriesDecorator
extends ControlDecorator<Subentries>
implements Subentries

A Subentries Control implementation which wraps and decorates Subentries Controls to enable them to be encoded and decoded by the codec.

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.api.ldap.codec.api.ControlDecorator
value, valueLength
 
Fields inherited from interface org.apache.directory.api.ldap.model.message.controls.Subentries
OID
 
Constructor Summary
SubentriesDecorator(LdapApiService codec)
          Default constructor
SubentriesDecorator(LdapApiService codec, Subentries control)
          Creates a Subentries decorating implementation for use with the codec, while decorating the supplied Subentries control.
 
Method Summary
 int computeLength()
          Compute the SubEntryControl length 0x01 0x01 [0x00|0xFF]
 Asn1Object decode(byte[] controlBytes)
          Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
 ByteBuffer encode(ByteBuffer buffer)
          Encodes the Subentries control.
 byte[] getValue()
          Get the control value
 boolean isVisible()
          Check if the subEntry is visible
 void setVisibility(boolean visibility)
          Set the visibility flag
 
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 class org.apache.directory.api.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.api.ldap.model.message.Control
getOid, isCritical, setCritical
 

Constructor Detail

SubentriesDecorator

public SubentriesDecorator(LdapApiService codec)
Default constructor


SubentriesDecorator

public SubentriesDecorator(LdapApiService codec,
                           Subentries control)
Creates a Subentries decorating implementation for use with the codec, while decorating the supplied Subentries control.

Parameters:
control - The Subentries Control to wrap with this decorator.
Method Detail

computeLength

public int computeLength()
Compute the SubEntryControl length 0x01 0x01 [0x00|0xFF]

Specified by:
computeLength in interface Asn1Object
Specified by:
computeLength in interface Decorator<Subentries>
Overrides:
computeLength in class ControlDecorator<Subentries>
Returns:
The object's computed length

encode

public ByteBuffer encode(ByteBuffer buffer)
                  throws EncoderException
Encodes the Subentries control.

Specified by:
encode in interface Asn1Object
Specified by:
encode in interface Decorator<Subentries>
Overrides:
encode in class AbstractAsn1Object
Parameters:
buffer - The encoded sink
Returns:
A ByteBuffer that contains the encoded PDU
Throws:
EncoderException - If anything goes wrong.

getValue

public byte[] getValue()
Get the control value

Specified by:
getValue in interface CodecControl<Subentries>
Overrides:
getValue in class ControlDecorator<Subentries>
Returns:
The control value

isVisible

public boolean isVisible()
Description copied from interface: Subentries
Check if the subEntry is visible

Specified by:
isVisible in interface Subentries
Returns:
true or false.

setVisibility

public void setVisibility(boolean visibility)
Description copied from interface: Subentries
Set the visibility flag

Specified by:
setVisibility in interface Subentries
Parameters:
visibility - The visibility flag : true or false

decode

public Asn1Object decode(byte[] controlBytes)
                  throws DecoderException
Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.

Specified by:
decode in interface CodecControl<Subentries>
Parameters:
controlBytes - the encoded control bytes
Returns:
the decoded Asn1Object for the control
Throws:
DecoderException - if anything goes wrong


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.