Package org.springframework.ldap.core
Class LdapAttribute
- java.lang.Object
-
- javax.naming.directory.BasicAttribute
-
- org.springframework.ldap.core.LdapAttribute
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,javax.naming.directory.Attribute
public class LdapAttribute extends javax.naming.directory.BasicAttributeExtendsBasicAttributeto 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
HashSetofString.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Set<java.lang.String>optionsHolds the attributes options.
-
Constructor Summary
Constructors Constructor Description LdapAttribute(java.lang.String id)Creates an unordered attribute with the specified ID.LdapAttribute(java.lang.String id, boolean ordered)Creates an attribute with the specified ID whose values may be ordered.LdapAttribute(java.lang.String id, java.lang.Object value)Creates an unordered attribute with the specified ID and value.LdapAttribute(java.lang.String id, java.lang.Object value, boolean ordered)Creates an attribute with the specified ID and value whose values may be ordered.LdapAttribute(java.lang.String id, java.lang.Object value, java.util.Collection<java.lang.String> options)Creates an unordered attribute with the specified ID, value, and options.LdapAttribute(java.lang.String id, java.lang.Object value, java.util.Collection<java.lang.String> options, boolean ordered)Creates an attribute with the specified ID, value, and options whose values may be ordered.LdapAttribute(java.lang.String id, java.util.Collection<java.lang.String> options, boolean ordered)Creates an attribute with the specified ID and options whose values may be ordered.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddAllOptions(java.util.Collection<java.lang.String> options)Add all values in the collection to the options.booleanaddOption(java.lang.String option)Add an option.voidclearOptions()Clears all stored options.booleancontains(java.lang.String option)Checks for existence of a particular option on the set.booleancontainsAll(java.util.Collection<java.lang.String> options)Checks for existence of a series of options on the set.java.util.Set<java.lang.String>getOptions()Get options.booleanhasOptions()Tests for the presence of options.booleanremoveAllOptions(java.util.Collection<java.lang.String> options)Removes all options listed in the supplied set.booleanremoveOption(java.lang.String option)Removes an option from the the set.booleanretainAllOptions(java.util.Collection<java.lang.String> options)Removes any options not on the set of supplied options.voidsetOptions(java.util.Set<java.lang.String> options)Set options.
-
-
-
Constructor Detail
-
LdapAttribute
public LdapAttribute(java.lang.String id)
Creates an unordered attribute with the specified ID.- Parameters:
id-StringID of the attribute.
-
LdapAttribute
public LdapAttribute(java.lang.String id, java.lang.Object value)Creates an unordered attribute with the specified ID and value.- Parameters:
id-StringID of the attribute.value- Attribute value.
-
LdapAttribute
public LdapAttribute(java.lang.String id, java.lang.Object value, java.util.Collection<java.lang.String> options)Creates an unordered attribute with the specified ID, value, and options.- Parameters:
id-StringID of the attribute.value- Attribute value.options-CollectionofStringattribute options.
-
LdapAttribute
public LdapAttribute(java.lang.String id, boolean ordered)Creates an attribute with the specified ID whose values may be ordered.- Parameters:
id-StringID of the attribute.ordered- boolean indicating whether or not the attributes values are ordered.
-
LdapAttribute
public LdapAttribute(java.lang.String id, java.util.Collection<java.lang.String> options, boolean ordered)Creates an attribute with the specified ID and options whose values may be ordered.- Parameters:
id-StringID of the attribute.options-CollectionofStringattribute options.ordered- boolean indicating whether or not the attributes values are ordered.
-
LdapAttribute
public LdapAttribute(java.lang.String id, java.lang.Object value, boolean ordered)Creates an attribute with the specified ID and value whose values may be ordered.- Parameters:
id-StringID of the attribute.value- Attribute value.ordered- boolean indicating whether or not the attributes values are ordered.
-
LdapAttribute
public LdapAttribute(java.lang.String id, java.lang.Object value, java.util.Collection<java.lang.String> options, boolean ordered)Creates an attribute with the specified ID, value, and options whose values may be ordered.- Parameters:
id-StringID of the attribute.value- Attribute value.options-CollectionofStringattribute options.ordered- boolean indicating whether or not the attributes values are ordered.
-
-
Method Detail
-
getOptions
public java.util.Set<java.lang.String> getOptions()
Get options.- Returns:
- returns a
SetofString
-
setOptions
public void setOptions(java.util.Set<java.lang.String> options)
Set options.- Parameters:
options-SetofString
-
addOption
public boolean addOption(java.lang.String option)
Add an option.- Parameters:
option-Stringoption.- Returns:
- boolean indication successful addition of option.
-
addAllOptions
public boolean addAllOptions(java.util.Collection<java.lang.String> options)
Add all values in the collection to the options.- Parameters:
options-CollectionofStringvalues.- Returns:
- boolean indication successful addition of options.
-
clearOptions
public void clearOptions()
Clears all stored options.
-
contains
public boolean contains(java.lang.String option)
Checks for existence of a particular option on the set.- Parameters:
option-Stringoption.- Returns:
- boolean indicating result.
-
containsAll
public boolean containsAll(java.util.Collection<java.lang.String> options)
Checks for existence of a series of options on the set.- Parameters:
options-CollectionofStringoptions.- Returns:
- boolean indicating result.
-
hasOptions
public boolean hasOptions()
Tests for the presence of options.- Returns:
- boolean indicating result.
-
removeOption
public boolean removeOption(java.lang.String option)
Removes an option from the the set.- Parameters:
option-Stringoption.- Returns:
- boolean indicating successful removal of option.
-
removeAllOptions
public boolean removeAllOptions(java.util.Collection<java.lang.String> options)
Removes all options listed in the supplied set.- Parameters:
options-CollectionofStringoptions.- Returns:
- boolean indicating successful removal of options.
-
retainAllOptions
public boolean retainAllOptions(java.util.Collection<java.lang.String> options)
Removes any options not on the set of supplied options.- Parameters:
options-CollectionofStringoptions.- Returns:
- boolean indicating successful retention of options.
-
-