public class LdapAttribute extends AbstractLdapBean
| Modifier and Type | Class and Description | 
|---|---|
private class  | 
LdapAttribute.LdapAttributeValues<T>
Simple bean for ldap attribute values. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
private String | 
attributeName
Name for this attribute. 
 | 
private LdapAttribute.LdapAttributeValues<?> | 
attributeValues
Values for this attribute. 
 | 
private static int | 
HASH_CODE_SEED
hash code seed. 
 | 
private static long | 
serialVersionUID
serial version uid. 
 | 
| Constructor and Description | 
|---|
LdapAttribute()
Default constructor. 
 | 
LdapAttribute(boolean binary)
Creates a new ldap attribute. 
 | 
LdapAttribute(SortBehavior sb)
Creates a new ldap attribute. 
 | 
LdapAttribute(SortBehavior sb,
             boolean binary)
Creates a new ldap attribute. 
 | 
LdapAttribute(String name)
Creates a new ldap attribute. 
 | 
LdapAttribute(String name,
             byte[]... values)
Creates a new ldap attribute. 
 | 
LdapAttribute(String name,
             String... values)
Creates a new ldap attribute. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addBinaryValue(byte[]... value)
Adds the supplied byte array as a value for this attribute. 
 | 
void | 
addBinaryValues(Collection<byte[]> values)
Adds all the byte arrays in the supplied collection as values for this attribute. 
 | 
void | 
addStringValue(String... value)
Adds the supplied string as a value for this attribute. 
 | 
void | 
addStringValues(Collection<String> values)
Adds all the strings in the supplied collection as values for this attribute. 
 | 
<T> void | 
addValue(ValueTranscoder<T> transcoder,
        T... value)
Adds the supplied values for this attribute by encoding them with the supplied transcoder. 
 | 
<T> void | 
addValues(ValueTranscoder<T> transcoder,
         Collection<T> values)
Adds all the values in the supplied collection for this attribute by encoding them with the supplied transcoder. 
 | 
void | 
clear()
Removes all the values in this ldap attribute. 
 | 
static LdapAttribute | 
createLdapAttribute(SortBehavior sb,
                   String name,
                   Collection<Object> values)
Creates a new ldap attribute. 
 | 
protected <E> Collection<E> | 
createSortBehaviorCollection(Class<E> c)
Returns an implementation of collection for the sort behavior of this bean. 
 | 
boolean | 
equals(Object o)  | 
static String | 
escapeValue(String value)
Escapes the supplied string value per RFC 4514 section 2.4. 
 | 
byte[] | 
getBinaryValue()
Returns a single byte array value of this attribute. 
 | 
Collection<byte[]> | 
getBinaryValues()
Returns the values of this attribute as byte arrays. 
 | 
private static <E> Comparator<E> | 
getComparator(Class<E> c)
Returns a comparator for the supplied class type. 
 | 
String | 
getName()
Returns the name of this attribute. 
 | 
String | 
getName(boolean withOptions)
Returns the name of this attribute with or without options. 
 | 
String[] | 
getOptions()
Returns the options for this attribute. 
 | 
String | 
getStringValue()
Returns a single string value of this attribute. 
 | 
Collection<String> | 
getStringValues()
Returns the values of this attribute as strings. 
 | 
<T> T | 
getValue(ValueTranscoder<T> transcoder)
Returns a single decoded value of this attribute. 
 | 
<T> Collection<T> | 
getValues(ValueTranscoder<T> transcoder)
Returns the values of this attribute decoded by the supplied transcoder. 
 | 
int | 
hashCode()  | 
boolean | 
isBinary()
Returns whether this ldap attribute contains a value of type byte[]. 
 | 
void | 
removeBinaryValue(byte[]... value)
Removes the supplied value from the attribute values if it exists. 
 | 
void | 
removeBinaryValues(Collection<byte[]> values)
Removes the supplied values from the attribute values if they exists. 
 | 
void | 
removeStringValue(String... value)
Removes the supplied value from the attribute values if it exists. 
 | 
void | 
removeStringValues(Collection<String> values)
Removes the supplied values from the attribute values if they exists. 
 | 
void | 
setName(String name)
Sets the name of this attribute. 
 | 
int | 
size()
Returns the number of values in this ldap attribute. 
 | 
String | 
toString()  | 
getSortBehaviorprivate static final int HASH_CODE_SEED
private static final long serialVersionUID
private String attributeName
private final LdapAttribute.LdapAttributeValues<?> attributeValues
public LdapAttribute()
public LdapAttribute(SortBehavior sb)
sb - sort behavior of this attributepublic LdapAttribute(boolean binary)
binary - whether this attribute contains binary valuespublic LdapAttribute(SortBehavior sb, boolean binary)
sb - sort behavior of this attributebinary - whether this attribute contains binary valuespublic LdapAttribute(String name)
name - of this attributepublic LdapAttribute(String name, String... values)
name - of this attributevalues - of this attributepublic LdapAttribute(String name, byte[]... values)
name - of this attributevalues - of this attributepublic String getName()
public String getName(boolean withOptions)
withOptions - whether options should be included in the namepublic void setName(String name)
name - to setpublic String[] getOptions()
public Collection<String> getStringValues()
public String getStringValue()
getStringValues().public Collection<byte[]> getBinaryValues()
public byte[] getBinaryValue()
getBinaryValues().public boolean isBinary()
public <T> Collection<T> getValues(ValueTranscoder<T> transcoder)
T - type of decoded attributestranscoder - to decode attribute values withpublic <T> T getValue(ValueTranscoder<T> transcoder)
getValues(ValueTranscoder).T - type of decoded attributestranscoder - to decode attribute values withpublic void addStringValue(String... value)
value - to addNullPointerException - if value is nullpublic void addStringValues(Collection<String> values)
addStringValue(String...).values - to addpublic void addBinaryValue(byte[]... value)
value - to addNullPointerException - if value is nullpublic void addBinaryValues(Collection<byte[]> values)
addBinaryValue(byte[][]).values - to addpublic <T> void addValue(ValueTranscoder<T> transcoder, T... value)
T - type attribute to encodetranscoder - to encode value withvalue - to encode and addNullPointerException - if value is nullpublic <T> void addValues(ValueTranscoder<T> transcoder, Collection<T> values)
addValue(ValueTranscoder, Object...).T - type attribute to encodetranscoder - to encode value withvalues - to encode and addpublic void removeStringValue(String... value)
value - to removepublic void removeStringValues(Collection<String> values)
removeStringValue(String...).values - to removepublic void removeBinaryValue(byte[]... value)
value - to removepublic void removeBinaryValues(Collection<byte[]> values)
removeBinaryValue(byte[][]).values - to removepublic int size()
public void clear()
protected <E> Collection<E> createSortBehaviorCollection(Class<E> c)
SortBehavior.UNORDERED, LinkedHashSet for SortBehavior.ORDERED, and TreeSet for SortBehavior.SORTED.E - contained in the collectionc - type contained in the collectionprivate static <E> Comparator<E> getComparator(Class<E> c)
Object.toString() for unknown types.E - type of classc - type to comparepublic static LdapAttribute createLdapAttribute(SortBehavior sb, String name, Collection<Object> values)
sb - sort behaviorname - of this attributevalues - of this attributeIllegalArgumentException - if values contains something other than String or byte[]Copyright © 2003-2019 Virginia Tech. All Rights Reserved.