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 -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
Reads the supplied buffer for content between two single quotes.protected String[]
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[]
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
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
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
-
Constructor Details
-
AbstractDefaultDefinitionFunction
public AbstractDefaultDefinitionFunction()
-
-
Method Details
-
validate
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
Reads the buffer until a space is encountered.- Parameters:
cb
- to read from- Returns:
- oid
-
readOIDs
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
Reads the buffer until a space is encountered. Converts the read string into an integer.- Parameters:
cb
- to read from- Returns:
- rule id
-
readRuleIDs
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
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
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
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
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
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
-