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 Details

    • AbstractDefaultDefinitionFunction

      public AbstractDefaultDefinitionFunction()
  • Method Details

    • 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 from
      c - to stop advancing at
      Returns:
      the last character read