netscape.ldap
Class LDAPAttribute
java.lang.Object
netscape.ldap.LDAPAttribute
- java.io.Serializable
public class LDAPAttribute
extends java.lang.Object
implements java.io.Serializable
Represents the name and values of an attribute in an entry.
LDAPAttribute(String attrName) - Constructs an attribute with no values.
|
LDAPAttribute(String attrName, String attrValue) - Constructs an attribute that has a single string value.
|
LDAPAttribute(String attrName, String[] attrValues) - Constructs an attribute that has an array of string values.
|
LDAPAttribute(String attrName, byte[] attrValue) - Constructs an attribute with a byte-formatted value.
|
LDAPAttribute(LDAPAttribute attr) - Constructs an attribute from another existing attribute.
|
LDAPAttribute(BERElement element) - Constructs an attribute from a BER (Basic Encoding Rules) element.
|
void | addValue(String attrValue) - Adds a string value to the attribute.
|
void | addValue(byte[] attrValue) - Adds a
byte[] -formatted value to the attribute.
|
BERElement | getBERElement() - Retrieves the BER (Basic Encoding Rules) representation of an attribute.
|
String | getBaseName() - Extracts the base name from the attribute name of the current
LDAPAttribute object.
|
static String | getBaseName(String attrName) - Extracts the base name from the specified attribute name.
|
byte[][] | getByteValueArray() - Returns the values of the attribute in an array of
byte[]
format.
|
Enumeration | getByteValues() - Returns an enumerator for the values of the attribute in
byte[]
format.
|
String | getLangSubtype() - Extracts the language subtype from the attribute name of the
LDAPAttribute object, if any.
|
String | getName() - Returns the name of the attribute.
|
String[] | getStringValueArray() - Returns the values of the attribute as an array of
String
objects.
|
Enumeration | getStringValues() - Returns an enumerator for the string values of an attribute.
|
String[] | getSubtypes() - Extracts the subtypes from the attribute name of the current
LDAPAttribute object.
|
static String[] | getSubtypes(String attrName) - Extracts the subtypes from the specified attribute name.
|
boolean | hasSubtype(String subtype) - Reports whether the attribute name contains the specified subtype.
|
boolean | hasSubtypes(String[] subtypes) - Reports if the attribute name contains all specified subtypes
For example, if you check for the subtypes
lang-en
and phonetic and the attribute name is
cn;lang-en;phonetic , this method returns true .
|
void | removeValue(String attrValue) - Removes a string value from the attribute.
|
void | removeValue(byte[] attrValue) - Removes a
byte[] -formatted value from the attribute.
|
protected void | setValues(Object[] attrValues) - Sets the byte[] values as the attribute's values.
|
protected void | setValues(String[] attrValues) - Sets the string values as the attribute's values.
|
int | size() - Returns the number of values of the attribute.
|
String | toString() - Retrieves the string representation of an attribute
in an LDAP entry.
|
LDAPAttribute
public LDAPAttribute(String attrName)
Constructs an attribute with no values.
attrName
- name of the attribute
LDAPAttribute
public LDAPAttribute(String attrName,
String attrValue)
Constructs an attribute that has a single string value.
attrName
- name of the attributeattrValue
- value of the attribute in String format
LDAPAttribute
public LDAPAttribute(String attrName,
String[] attrValues)
Constructs an attribute that has an array of string values.
attrName
- name of the attributeattrValues
- the list of string values for this attribute
LDAPAttribute
public LDAPAttribute(String attrName,
byte[] attrValue)
Constructs an attribute with a byte-formatted value.
attrName
- name of the attributeattrValue
- value of the attribute in byte format
LDAPAttribute
public LDAPAttribute(LDAPAttribute attr)
Constructs an attribute from another existing attribute.
Effectively, this makes a copy of the existing attribute.
attr
- the attribute to copy
LDAPAttribute
public LDAPAttribute(BERElement element)
throws IOException
Constructs an attribute from a BER (Basic Encoding Rules) element.
(The protocol elements of LDAP are encoded for exchange using the
Basic Encoding Rules.)
element
- element that you want translated into an attribute
addValue
public void addValue(String attrValue)
Adds a string value to the attribute.
attrValue
- the string value to add to the attribute
addValue
public void addValue(byte[] attrValue)
Adds a byte[]
-formatted value to the attribute.
attrValue
- the byte[]
-formatted value to
add to the attribute
getBERElement
public BERElement getBERElement()
Retrieves the BER (Basic Encoding Rules) representation of an attribute.
(The protocol elements of LDAP are encoded for exchange using the
Basic Encoding Rules.)
- the BER representation of the attribute.
getBaseName
public String getBaseName()
Extracts the base name from the attribute name of the current
LDAPAttribute
object. For example, if the attribute
name is
cn;lang-ja;phonetic
, this method returns
cn
.
- base name (the attribute name without any subtypes).
netscape.ldap.LDAPAttribute.getSubtypes
getBaseName
public static String getBaseName(String attrName)
Extracts the base name from the specified attribute name.
For example, if the attribute name is
cn;lang-ja;phonetic
,
this method returns
cn
.
attrName
- name of the attribute from which to extract the base name
- base name (the attribute name without any subtypes).
netscape.ldap.LDAPAttribute.getSubtypes
getByteValueArray
public byte[][] getByteValueArray()
Returns the values of the attribute in an array of byte[]
format.
- array of attribute values. Each element in the array
will be of type
byte[]
.
getByteValues
public Enumeration getByteValues()
Returns an enumerator for the values of the attribute in byte[]
format.
- a set of attribute values. Each element in the enumeration
is of type
byte[]
.
getLangSubtype
public String getLangSubtype()
Extracts the language subtype from the attribute name of the
LDAPAttribute
object, if any. For example, if the
attribute name is
cn;lang-ja;phonetic
, this method
returns the String
lang-ja
.
- the language subtype, or null (if the name has no
language subtype).
getName
public String getName()
Returns the name of the attribute.
getStringValueArray
public String[] getStringValueArray()
Returns the values of the attribute as an array of String
objects.
- array of attribute values. Each element in the array
is a
String
object.
getStringValues
public Enumeration getStringValues()
Returns an enumerator for the string values of an attribute.
- enumerator for the string values.
getSubtypes
public String[] getSubtypes()
Extracts the subtypes from the attribute name of the current
LDAPAttribute
object. For example, if the attribute
name is
cn;lang-ja;phonetic
, this method returns an array
containing
lang-ja
and
phonetic
.
- array of subtypes, or null (if the name has no subtypes).
getSubtypes
public static String[] getSubtypes(String attrName)
Extracts the subtypes from the specified attribute name.
For example, if the attribute name is
cn;lang-ja;phonetic
,
this method returns an array containing
lang-ja
and
phonetic
.
attrName
- name of the attribute from which to extract the subtypes
- array of subtypes, or null (if the name has no subtypes).
netscape.ldap.LDAPAttribute.getBaseName
hasSubtype
public boolean hasSubtype(String subtype)
Reports whether the attribute name contains the specified subtype.
For example, if you check for the subtype
lang-en
and the attribute name is
cn;lang-en
, this method
returns
true
.
subtype
- the single subtype for which you want to check
- true if the attribute name contains the specified subtype.
netscape.ldap.LDAPAttribute.getSubtypes
hasSubtypes
public boolean hasSubtypes(String[] subtypes)
Reports if the attribute name contains all specified subtypes
For example, if you check for the subtypes
lang-en
and
phonetic
and the attribute name is
cn;lang-en;phonetic
, this method returns
true
.
If the attribute name is
cn;phonetic
or
cn;lang-en
, this method returns
false
.
subtypes
- an array of subtypes to check
- true if the attribute name contains all subtypes
netscape.ldap.LDAPAttribute.getSubtypes
removeValue
public void removeValue(String attrValue)
Removes a string value from the attribute.
attrValue
- the string value to remove
removeValue
public void removeValue(byte[] attrValue)
Removes a byte[]
-formatted value from the attribute.
attrValue
- byte[]
-formatted value to remove
setValues
protected void setValues(Object[] attrValues)
Sets the byte[] values as the attribute's values.
attrValues
- the values to use in the attribute
setValues
protected void setValues(String[] attrValues)
Sets the string values as the attribute's values.
attrValues
- the string values to use in the attribute
size
public int size()
Returns the number of values of the attribute.
- number of values for this attribute.
toString
public String toString()
Retrieves the string representation of an attribute
in an LDAP entry. For example:
LDAPAttribute {type='cn', values='Barbara Jensen,Babs Jensen'}
- string representation of the attribute.