Class LDAPAttributeSet
- All Implemented Interfaces:
Serializable
,Cloneable
- Version:
- 1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new set of attributes.LDAPAttributeSet
(LDAPAttribute[] attrs) Constructs an attribute set. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(LDAPAttribute attr) Adds the specified attribute to this attribute set.clone()
elementAt
(int index) Returns the attribute at the position specified by the index.getAttribute
(String attrName) Returns a single attribute that exactly matches the specified attribute name.getAttribute
(String attrName, String lang) Returns the subtype that matches the attribute name specified byattrName
and the language specificaton identified bylang
.Returns an enumeration of the attributes in this attribute set.Creates a new attribute set containing only the attributes that have the specified subtypes.void
Removes the specified attribute from the set.void
removeElementAt
(int index) Removes the attribute at the position specified by the index.int
size()
Returns the number of attributes in this set.toString()
Retrieves the string representation of all attributes in the attribute set.
-
Constructor Details
-
LDAPAttributeSet
public LDAPAttributeSet()Constructs a new set of attributes. This set is initially empty. -
LDAPAttributeSet
Constructs an attribute set.- Parameters:
attrs
- the list of attributes
-
-
Method Details
-
clone
-
getAttributes
Returns an enumeration of the attributes in this attribute set.- Returns:
- enumeration of the attributes in this set.
-
getSubset
Creates a new attribute set containing only the attributes that have the specified subtypes.For example, suppose an attribute set contains the following attributes:
cn cn;lang-ja sn;phonetic;lang-ja sn;lang-us
If you call thegetSubset
method and passlang-ja
as the argument, the method returns an attribute set containing the following attributes:cn;lang-ja sn;phonetic;lang-ja
- Parameters:
subtype
- semi-colon delimited list of subtypes to find within attribute names. For example:"lang-ja" // Only Japanese language subtypes "binary" // Only binary subtypes "binary;lang-ja" // Only Japanese language subtypes which also are binary
- Returns:
- attribute set containing the attributes that have the specified subtypes.
- See Also:
-
getAttribute
Returns a single attribute that exactly matches the specified attribute name.- Parameters:
attrName
- name of attribute to return For example:"cn" // Only a non-subtyped version of cn "cn;lang-ja" // Only a Japanese version of cn
- Returns:
- attribute that has exactly the same name, or null (if no attribute in the set matches the specified name).
- See Also:
-
getAttribute
Returns the subtype that matches the attribute name specified byattrName
and the language specificaton identified bylang
.If no attribute in the set has the specified name and subtype, the method returns
null
. Attributes containing subtypes other thanlang
(for example,cn;binary
) are returned only if they contain the specifiedlang
subtype and if the set contains no attribute having only thelang
subtype. (For example,getAttribute( "cn", "lang-ja" )
returnscn;lang-ja;phonetic
only if thecn;lang-ja
attribute does not exist.)If null is specified for the
lang
argument, calling this method is the same as calling thegetAttribute(attrName)
method.For example, suppose an entry contains only the following attributes:
cn;lang-en
cn;lang-ja-JP-kanji
sn
Calling the following methods will return the following values:
getAttribute( "cn" )
returnsnull
.getAttribute( "sn" )
returns the "sn
" attribute.getAttribute( "cn", "lang-en-us" )
returns the "cn;lang-en
" attribute.getAttribute( "cn", "lang-en" )
returns the "cn;lang-en
" attribute.getAttribute( "cn", "lang-ja" )
returnsnull
.getAttribute( "sn", "lang-en" )
returns the "sn
" attribute.
- Parameters:
attrName
- name of attribute to find in the entrylang
- a language specification- Returns:
- the attribute that matches the base name and that best matches any specified language subtype.
- See Also:
-
elementAt
Returns the attribute at the position specified by the index. For example, if you specify the index 0, the method returns the first attribute in the set. The index is 0-based.- Parameters:
index
- index of the attribute to obtain- Returns:
- attribute at the position specified by the index.
-
removeElementAt
public void removeElementAt(int index) Removes the attribute at the position specified by the index. For example, if you specify the index 0, the method removes the first attribute in the set. The index is 0-based.- Parameters:
index
- index of the attribute to remove
-
size
public int size()Returns the number of attributes in this set.- Returns:
- number of attributes in this attribute set.
-
add
Adds the specified attribute to this attribute set.- Parameters:
attr
- attribute to add to this set
-
remove
Removes the specified attribute from the set.- Parameters:
name
- name of the attribute to remove
-
toString
Retrieves the string representation of all attributes in the attribute set. For example:LDAPAttributeSet: LDAPAttribute {type='cn', values='Barbara Jensen,Babs Jensen'}LDAPAttribute {type='sn', values='Jensen'}LDAPAttribute {type=' givenname', values='Barbara'}LDAPAttribute {type='objectclass', values= 'top,person,organizationalPerson,inetOrgPerson'}LDAPAttribute {type='ou', values='Product Development,People'}
-