Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
netscape.ldap.LDAPAttributeSet
public class LDAPAttributeSet
extends java.lang.Object
implements Cloneable, java.io.Serializable
LDAPAttribute
, Serialized FormConstructor Summary | |
| |
|
Method Summary | |
void |
|
Object |
|
LDAPAttribute |
|
LDAPAttribute |
|
LDAPAttribute |
|
Enumeration |
|
LDAPAttributeSet |
|
void |
|
void |
|
int |
|
String |
|
public LDAPAttributeSet()
Constructs a new set of attributes. This set is initially empty.
public LDAPAttributeSet(LDAPAttribute[] attrs)
Constructs an attribute set.
- Parameters:
attrs
- the list of attributes
public void add(LDAPAttribute attr)
Adds the specified attribute to this attribute set.
- Parameters:
attr
- attribute to add to this set
public Object clone()
public LDAPAttribute elementAt(int index)
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.
public LDAPAttribute getAttribute(String attrName)
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:
LDAPAttribute
public LDAPAttribute getAttribute(String attrName, String lang)
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 returnsnull
. 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 thelang
argument, calling this method is the same as calling thegetAttribute(attrName)
method. For example, suppose an entry contains only the following attributes:Calling the following methods will return the following values:
cn;lang-en
cn;lang-ja-JP-kanji
sn
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:
LDAPAttribute
public Enumeration getAttributes()
Returns an enumeration of the attributes in this attribute set.
- Returns:
- enumeration of the attributes in this set.
public LDAPAttributeSet getSubset(String subtype)
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-usIf 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:
LDAPAttribute
,netscape.ldap.LDAPAttributeSet.getAttribute
,netscape.ldap.LDAPEntry.getAttributeSet
public void remove(String name)
Removes the specified attribute from the set.
- Parameters:
name
- name of the attribute to remove
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
public int size()
Returns the number of attributes in this set.
- Returns:
- number of attributes in this attribute set.
public String 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'}
- Returns:
- string representation of all attributes in the set.