Enum FastDnParser
- java.lang.Object
-
- java.lang.Enum<FastDnParser>
-
- org.apache.directory.api.ldap.model.name.FastDnParser
-
- All Implemented Interfaces:
Serializable,Comparable<FastDnParser>
enum FastDnParser extends Enum<FastDnParser>
A fast LDAP Dn parser that handles only simple DNs. If the Dn contains any special character anLdapInvalidDnExceptionis thrown.- Author:
- Apache Directory Project
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description privateFastDnParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static booleanhasMoreChars(org.apache.directory.api.util.Position pos)Checks if there are more characters.private static StringmatchAttributeType(char[] name, org.apache.directory.api.util.Position pos)Matches attribute type.private static StringmatchAttributeTypeDescr(char[] name, org.apache.directory.api.util.Position pos)Matches attribute type descr.private static StringmatchAttributeTypeNumericOid(char[] name, org.apache.directory.api.util.Position pos)Matches attribute type numeric OID.private static voidmatchEquals(char[] name, org.apache.directory.api.util.Position pos)Matches the equals character.private static voidmatchSpaces(char[] name, org.apache.directory.api.util.Position pos)Matches and forgets optional spaces.private static StringmatchValue(char[] name, org.apache.directory.api.util.Position pos)Matches the assertion value.private static charnextChar(char[] name, org.apache.directory.api.util.Position pos, boolean increment)Gets the next character.(package private) static Dnparse(String name)Parses a Dn from a String(package private) static Dnparse(SchemaManager schemaManager, String name)Parses a Dn from a String(package private) static StringparseDn(SchemaManager schemaManager, String name, List<Rdn> rdns)(package private) static voidparseDn(SchemaManager schemaManager, String name, Dn dn)Parses the given name string and fills the given Dn object.(package private) static voidparseRdn(SchemaManager schemaManager, String name, Rdn rdn)Parses the given name string and fills the given Rdn object.private static voidparseRdnInternal(SchemaManager schemaManager, String name, org.apache.directory.api.util.Position pos, Rdn rdn)static FastDnParservalueOf(String name)Returns the enum constant of this type with the specified name.static FastDnParser[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final FastDnParser INSTANCE
-
-
Method Detail
-
values
public static FastDnParser[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (FastDnParser c : FastDnParser.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FastDnParser valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
parse
static Dn parse(String name) throws LdapException
Parses a Dn from a String- Parameters:
name- The Dn to parse- Returns:
- A valid Dn
- Throws:
LdapException- If the Dn was invalid
-
parse
static Dn parse(SchemaManager schemaManager, String name) throws LdapException
Parses a Dn from a String- Parameters:
schemaManager- The SchemaManagername- The Dn to parse- Returns:
- A valid Dn
- Throws:
LdapException- If the Dn was invalid
-
parseDn
static void parseDn(SchemaManager schemaManager, String name, Dn dn) throws LdapInvalidDnException
Parses the given name string and fills the given Dn object.- Parameters:
schemaManager- The SchemaManagername- the name to parsedn- the Dn to fill- Throws:
LdapInvalidDnException- the invalid name exception
-
parseDn
static String parseDn(SchemaManager schemaManager, String name, List<Rdn> rdns) throws LdapInvalidDnException
- Throws:
LdapInvalidDnException
-
parseRdn
static void parseRdn(SchemaManager schemaManager, String name, Rdn rdn) throws LdapInvalidDnException
Parses the given name string and fills the given Rdn object.- Parameters:
schemaManager- The SchemaManagername- the name to parserdn- the Rdn to fill- Throws:
LdapInvalidDnException- the invalid name exception
-
parseRdnInternal
private static void parseRdnInternal(SchemaManager schemaManager, String name, org.apache.directory.api.util.Position pos, Rdn rdn) throws LdapInvalidDnException
- Throws:
LdapInvalidDnException
-
matchSpaces
private static void matchSpaces(char[] name, org.apache.directory.api.util.Position pos) throws LdapInvalidDnExceptionMatches and forgets optional spaces.- Parameters:
name- the namepos- the pos- Throws:
LdapInvalidDnException- If some invalid chars are found
-
matchAttributeType
private static String matchAttributeType(char[] name, org.apache.directory.api.util.Position pos) throws LdapInvalidDnException
Matches attribute type.- Parameters:
name- the namepos- the pos- Returns:
- the matched attribute type
- Throws:
LdapInvalidDnException- the invalid name exception
-
matchAttributeTypeDescr
private static String matchAttributeTypeDescr(char[] name, org.apache.directory.api.util.Position pos) throws LdapInvalidDnException
Matches attribute type descr.- Parameters:
name- the namepos- the pos- Returns:
- the attribute type descr
- Throws:
LdapInvalidDnException- the invalid name exception
-
matchAttributeTypeNumericOid
private static String matchAttributeTypeNumericOid(char[] name, org.apache.directory.api.util.Position pos) throws LdapInvalidDnException
Matches attribute type numeric OID.- Parameters:
name- the namepos- the pos- Returns:
- the attribute type OID
- Throws:
LdapInvalidDnException- the invalid name exception
-
matchEquals
private static void matchEquals(char[] name, org.apache.directory.api.util.Position pos) throws LdapInvalidDnExceptionMatches the equals character.- Parameters:
name- the namepos- the pos- Throws:
LdapInvalidDnException- the invalid name exception
-
matchValue
private static String matchValue(char[] name, org.apache.directory.api.util.Position pos) throws LdapInvalidDnException
Matches the assertion value. This method only handles simple values. If we find any special character (BACKSLASH, PLUS, SHARP or DQUOTE), a LdapInvalidDnException will be thrown.- Parameters:
name- the namepos- the pos- Returns:
- the string
- Throws:
LdapInvalidDnException- the invalid name exception
-
nextChar
private static char nextChar(char[] name, org.apache.directory.api.util.Position pos, boolean increment) throws LdapInvalidDnExceptionGets the next character.- Parameters:
name- the namepos- the posincrement- true to increment the position- Returns:
- the character
- Throws:
LdapInvalidDnException- If no more characters are available
-
hasMoreChars
private static boolean hasMoreChars(org.apache.directory.api.util.Position pos)
Checks if there are more characters.- Parameters:
pos- the pos- Returns:
- true, if more characters are available
-
-