Spring LDAP

org.springframework.ldap.core
Class LdapAttribute

java.lang.Object
  extended by javax.naming.directory.BasicAttribute
      extended by org.springframework.ldap.core.LdapAttribute
All Implemented Interfaces:
Serializable, Cloneable, Attribute

public class LdapAttribute
extends BasicAttribute

Extends BasicAttribute to add support for options as defined in RFC2849.

While uncommon, options can be used to specify additional descriptors for the attribute. Options are backed by a HashSet of String.

Author:
Keith Barlow
See Also:
Serialized Form

Field Summary
protected  Set<String> options
          Holds the attributes options.
 
Fields inherited from class javax.naming.directory.BasicAttribute
attrID, ordered, values
 
Constructor Summary
LdapAttribute(String id)
          Creates an unordered attribute with the specified ID.
LdapAttribute(String id, boolean ordered)
          Creates an attribute with the specified ID whose values may be ordered.
LdapAttribute(String id, Collection<String> options, boolean ordered)
          Creates an attribute with the specified ID and options whose values may be ordered.
LdapAttribute(String id, Object value)
          Creates an unordered attribute with the specified ID and value.
LdapAttribute(String id, Object value, boolean ordered)
          Creates an attribute with the specified ID and value whose values may be ordered.
LdapAttribute(String id, Object value, Collection<String> options)
          Creates an unordered attribute with the specified ID, value, and options.
LdapAttribute(String id, Object value, Collection<String> options, boolean ordered)
          Creates an attribute with the specified ID, value, and options whose values may be ordered.
 
Method Summary
 boolean addAllOptions(Collection<String> options)
          Add all values in the collection to the options.
 boolean addOption(String option)
          Add an option.
 void clearOptions()
          Clears all stored options.
 boolean contains(String option)
          Checks for existence of a particular option on the set.
 boolean containsAll(Collection<String> options)
          Checks for existence of a series of options on the set.
 Set<String> getOptions()
          Get options.
 boolean hasOptions()
          Tests for the presence of options.
 boolean removeAllOptions(Collection<String> options)
          Removes all options listed in the supplied set.
 boolean removeOption(String option)
          Removes an option from the the set.
 boolean retainAllOptions(Collection<String> options)
          Removes any options not on the set of supplied options.
 void setOptions(Set<String> options)
          Set options.
 
Methods inherited from class javax.naming.directory.BasicAttribute
add, add, clear, clone, contains, equals, get, get, getAll, getAttributeDefinition, getAttributeSyntaxDefinition, getID, hashCode, isOrdered, remove, remove, set, size, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

options

protected Set<String> options
Holds the attributes options.

Constructor Detail

LdapAttribute

public LdapAttribute(String id)
Creates an unordered attribute with the specified ID.

Parameters:
id - String ID of the attribute.

LdapAttribute

public LdapAttribute(String id,
                     Object value)
Creates an unordered attribute with the specified ID and value.

Parameters:
id - String ID of the attribute.
value - Attribute value.

LdapAttribute

public LdapAttribute(String id,
                     Object value,
                     Collection<String> options)
Creates an unordered attribute with the specified ID, value, and options.

Parameters:
id - String ID of the attribute.
value - Attribute value.
options - Collection of String attribute options.

LdapAttribute

public LdapAttribute(String id,
                     boolean ordered)
Creates an attribute with the specified ID whose values may be ordered.

Parameters:
id - String ID of the attribute.
ordered - boolean indicating whether or not the attributes values are ordered.

LdapAttribute

public LdapAttribute(String id,
                     Collection<String> options,
                     boolean ordered)
Creates an attribute with the specified ID and options whose values may be ordered.

Parameters:
id - String ID of the attribute.
options - Collection of String attribute options.
ordered - boolean indicating whether or not the attributes values are ordered.

LdapAttribute

public LdapAttribute(String id,
                     Object value,
                     boolean ordered)
Creates an attribute with the specified ID and value whose values may be ordered.

Parameters:
id - String ID of the attribute.
value - Attribute value.
ordered - boolean indicating whether or not the attributes values are ordered.

LdapAttribute

public LdapAttribute(String id,
                     Object value,
                     Collection<String> options,
                     boolean ordered)
Creates an attribute with the specified ID, value, and options whose values may be ordered.

Parameters:
id - String ID of the attribute.
value - Attribute value.
options - Collection of String attribute options.
ordered - boolean indicating whether or not the attributes values are ordered.
Method Detail

getOptions

public Set<String> getOptions()
Get options.

Returns:
returns a Set of String

setOptions

public void setOptions(Set<String> options)
Set options.

Parameters:
options - Set of String

addOption

public boolean addOption(String option)
Add an option.

Parameters:
option - String option.
Returns:
boolean indication successful addition of option.

addAllOptions

public boolean addAllOptions(Collection<String> options)
Add all values in the collection to the options.

Parameters:
options - Collection of String values.
Returns:
boolean indication successful addition of options.

clearOptions

public void clearOptions()
Clears all stored options.


contains

public boolean contains(String option)
Checks for existence of a particular option on the set.

Parameters:
option - String option.
Returns:
boolean indicating result.

containsAll

public boolean containsAll(Collection<String> options)
Checks for existence of a series of options on the set.

Parameters:
options - Collection of String options.
Returns:
boolean indicating result.

hasOptions

public boolean hasOptions()
Tests for the presence of options.

Returns:
boolean indicating result.

removeOption

public boolean removeOption(String option)
Removes an option from the the set.

Parameters:
option - String option.
Returns:
boolean indicating successful removal of option.

removeAllOptions

public boolean removeAllOptions(Collection<String> options)
Removes all options listed in the supplied set.

Parameters:
options - Collection of String options.
Returns:
boolean indicating successful removal of options.

retainAllOptions

public boolean retainAllOptions(Collection<String> options)
Removes any options not on the set of supplied options.

Parameters:
options - Collection of String options.
Returns:
boolean indicating successful retention of options.

Spring LDAP