Package org.ldaptive.schema
Class AbstractDefaultDefinitionFunction<T extends SchemaElement>
- java.lang.Object
-
- org.ldaptive.schema.AbstractDefaultDefinitionFunction<T>
-
- Type Parameters:
T
- type of schema element
- All Implemented Interfaces:
DefinitionFunction<T>
- Direct Known Subclasses:
AttributeType.DefaultDefinitionFunction
,DITContentRule.DefaultDefinitionFunction
,DITStructureRule.DefaultDefinitionFunction
,MatchingRule.DefaultDefinitionFunction
,MatchingRuleUse.DefaultDefinitionFunction
,NameForm.DefaultDefinitionFunction
,ObjectClass.DefaultDefinitionFunction
,Syntax.DefaultDefinitionFunction
public abstract class AbstractDefaultDefinitionFunction<T extends SchemaElement> extends Object implements DefinitionFunction<T>
Base class for default definition functions.
-
-
Constructor Summary
Constructors Constructor Description AbstractDefaultDefinitionFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
readOID(CharBuffer cb)
Reads the buffer until a space is encountered.protected String[]
readOIDs(CharBuffer cb)
Reads the supplied buffer for $ delimited data between an open and closed parenthesis.protected String
readQDString(CharBuffer cb)
Reads the supplied buffer for content between two single quotes.protected String[]
readQDStrings(CharBuffer cb)
Reads the supplied buffer for single quoted data between an open and closed parenthesis.protected int
readRuleID(CharBuffer cb)
Reads the buffer until a space is encountered.protected int[]
readRuleIDs(CharBuffer cb)
Reads the supplied buffer for space delimited data between an open and closed parenthesis.private char
readUntil(CharBuffer cb, char c)
Advances the buffer position until the supplied character is found or the end of the buffer is reached.protected String
readUntilSpace(CharBuffer cb)
Reads the supplied buffer until a space is found.protected void
skipSpaces(CharBuffer cb)
Advances the buffer position to the first character that is not a space or the end of the buffer is reached.protected CharBuffer
validate(String definition)
Validates that the supplied definition is generally of the correct form.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ldaptive.schema.DefinitionFunction
parse
-
-
-
-
Method Detail
-
validate
protected CharBuffer validate(String definition) throws SchemaParseException
Validates that the supplied definition is generally of the correct form. Must start with an open parenthesis and end with a close parenthesis.- Parameters:
definition
- to validate- Returns:
- buffer without opening and closing parenthesis
- Throws:
SchemaParseException
- if the buffer is invalid
-
readOID
protected String readOID(CharBuffer cb)
Reads the buffer until a space is encountered.- Parameters:
cb
- to read from- Returns:
- oid
-
readOIDs
protected String[] readOIDs(CharBuffer cb)
Reads the supplied buffer for $ delimited data between an open and closed parenthesis. Returns an array of integers containing each rule ID that was read. If the buffer doesn't start with an open parenthesis, an array of a single oid is returned. Advances the buffer to the position after the string.- Parameters:
cb
- to read from- Returns:
- oids
-
readRuleID
protected int readRuleID(CharBuffer cb)
Reads the buffer until a space is encountered. Converts the read string into an integer.- Parameters:
cb
- to read from- Returns:
- rule id
-
readRuleIDs
protected int[] readRuleIDs(CharBuffer cb)
Reads the supplied buffer for space delimited data between an open and closed parenthesis. Returns an array of integers containing each rule ID that was read. Advances the buffer to the position after the string.- Parameters:
cb
- to read from- Returns:
- rule ids
-
readQDString
protected String readQDString(CharBuffer cb)
Reads the supplied buffer for content between two single quotes. Returns a string for the portion of the buffer that was read. Advances the buffer to the position after the string.- Parameters:
cb
- to read from- Returns:
- string read from the buffer
-
readQDStrings
protected String[] readQDStrings(CharBuffer cb)
Reads the supplied buffer for single quoted data between an open and closed parenthesis. Returns an array of strings containing each qdstring that was read. If the buffer contains only data between single quotes, an array of a single qdstring is returned. Advances the buffer to the position after the string.- Parameters:
cb
- to read from- Returns:
- string read from the buffer
-
readUntilSpace
protected String readUntilSpace(CharBuffer cb)
Reads the supplied buffer until a space is found. Returns a string for the portion of the buffer that was read. Advances the buffer to the position after the string.- Parameters:
cb
- to read from- Returns:
- string read from the buffer or empty string if the buffer has no remaining characters
-
skipSpaces
protected void skipSpaces(CharBuffer cb)
Advances the buffer position to the first character that is not a space or the end of the buffer is reached. No-op if the buffer has no remaining characters.- Parameters:
cb
- to read from
-
readUntil
private char readUntil(CharBuffer cb, char c)
Advances the buffer position until the supplied character is found or the end of the buffer is reached.- Parameters:
cb
- to read fromc
- to stop advancing at- Returns:
- the last character read
-
-