public final class AttributeUtils extends Object
| Modifier | Constructor and Description |
|---|---|
private |
AttributeUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
applyModification(Entry entry,
Modification modification)
A method to apply a modification to an existing entry.
|
static boolean |
containsValueCaseIgnore(Attribute attr,
Object value)
Check if an attribute contains a value.
|
static String |
parseAttribute(byte[] bytes,
org.apache.directory.api.util.Position pos,
boolean withOption,
boolean relaxed)
Parse an attribute.
|
static String |
parseAttribute(char[] str,
org.apache.directory.api.util.Position pos,
boolean withOption,
boolean relaxed)
Parse an attribute.
|
private static boolean |
parseNumber(byte[] bytes,
org.apache.directory.api.util.Position pos)
Parse a number :
|
private static boolean |
parseNumber(char[] filter,
org.apache.directory.api.util.Position pos)
Parse a number :
|
private static void |
parseOID(byte[] bytes,
org.apache.directory.api.util.Position pos)
Parse an OID.
|
private static void |
parseOID(char[] str,
org.apache.directory.api.util.Position pos)
Parse an OID.
|
private static void |
parseOptions(byte[] bytes,
org.apache.directory.api.util.Position pos)
Parse attribute's options :
|
private static void |
parseOptions(char[] str,
org.apache.directory.api.util.Position pos)
Parse attribute's options :
|
static Attribute |
toApiAttribute(Attribute jndiAttribute)
Convert a JNDI Attribute to an LDAP API Attribute
|
static Attributes |
toAttributes(Entry entry)
Converts an
Entry to an Attributes. |
static Attributes |
toCaseInsensitive(Attributes attributes)
Check if the attributes is a BasicAttributes, and if so, switch
the case sensitivity to false to avoid tricky problems in the server.
|
static Entry |
toEntry(Attributes attributes,
Dn dn)
Convert a BasicAttributes or a AttributesImpl to an Entry
|
static Attribute |
toJndiAttribute(Attribute attribute)
Converts an
Attribute to a JNDI Attribute. |
public static boolean containsValueCaseIgnore(Attribute attr, Object value)
attr - The attribute to checkvalue - The value to look forpublic static Attributes toCaseInsensitive(Attributes attributes)
attributes - The Attributes to checkprivate static void parseOptions(char[] str,
org.apache.directory.api.util.Position pos)
throws ParseException
options = *( ';' option ) option = 1*keychar keychar = 'a'-z' | 'A'-'Z' / '0'-'9' / '-'
str - The parsed optionpos - The position in the parsed option stringParseException - The parsed option is invalidprivate static void parseOptions(byte[] bytes,
org.apache.directory.api.util.Position pos)
throws ParseException
options = *( ';' option ) option = 1*keychar keychar = 'a'-z' | 'A'-'Z' / '0'-'9' / '-'
bytes - The parsed optionpos - The position in the parsed option bytesParseException - The parsed option is invalidprivate static boolean parseNumber(char[] filter,
org.apache.directory.api.util.Position pos)
number = '0' | '1'..'9' digits digits = '0'..'9'*
filter - The number in the filterpos - The position in the parsed filter stringprivate static boolean parseNumber(byte[] bytes,
org.apache.directory.api.util.Position pos)
number = '0' | '1'..'9' digits digits = '0'..'9'*
bytes - The parsed numberpos - The position in the parsed number stringprivate static void parseOID(char[] str,
org.apache.directory.api.util.Position pos)
throws ParseException
str - The OID to parsepos - The current position in the stringParseException - If we don't have a valid OIDprivate static void parseOID(byte[] bytes,
org.apache.directory.api.util.Position pos)
throws ParseException
bytes - The OID to parsepos - The current position in the stringParseException - If we don't have a valid OIDpublic static String parseAttribute(char[] str, org.apache.directory.api.util.Position pos, boolean withOption, boolean relaxed) throws ParseException
str - The parsed attribute,pos - The position of the attribute in the current stringwithOption - A flag set if we want to parse the optionsrelaxed - A flag set if we want to parse without being too strictParseException - If we had an issue while parsing the attributepublic static String parseAttribute(byte[] bytes, org.apache.directory.api.util.Position pos, boolean withOption, boolean relaxed) throws ParseException
bytes - The parsed attribute,pos - The position of the attribute in the current stringwithOption - A flag set if we want to parse the optionsrelaxed - A flag set if we want to parse without being too strictParseException - If we had an issue while parsing the attributepublic static void applyModification(Entry entry, Modification modification) throws LdapException
entry - The entry on which we want to apply a modificationmodification - the Modification to be appliedLdapException - if some operation fails.public static Entry toEntry(Attributes attributes, Dn dn) throws LdapException
attributes - the BasicAttributes or AttributesImpl instance to convertdn - The Dn which is needed by the EntryLdapException - If we get an invalid attributepublic static Attributes toAttributes(Entry entry)
Entry to an Attributes.entry - the Entry to convertAttributespublic static Attribute toJndiAttribute(Attribute attribute)
Attribute to a JNDI Attribute.attribute - the Attribute to convertpublic static Attribute toApiAttribute(Attribute jndiAttribute) throws LdapInvalidAttributeValueException
jndiAttribute - the JNDI Attribute instance to convertLdapInvalidAttributeValueException - If the attribute is invalidCopyright © 2003–2019 The Apache Software Foundation. All rights reserved.