Class DefaultFilterFunction

    • Field Detail

      • DEFAULT_ATTRIBUTE_DESCRIPTION_CHARS

        protected static final String DEFAULT_ATTRIBUTE_DESCRIPTION_CHARS
        Lower and upper case ASCII alphabetical, digits, semi-colon, dot, dash.
        See Also:
        Constant Field Values
      • attributeDescriptionChars

        private final String attributeDescriptionChars
        Allowed attribute description characters.
    • Constructor Detail

      • DefaultFilterFunction

        public DefaultFilterFunction()
        Default constructor.
      • DefaultFilterFunction

        public DefaultFilterFunction​(String validChars)
        Creates a new default filter function.
        Parameters:
        validChars - characters that are valid for an attribute description
    • Method Detail

      • readAttribute

        private CharBuffer readAttribute​(CharBuffer cb)
                                  throws FilterParseException
        Returns a new buffer containing an attribute description. The supplied buffer will have its position set to the next position after the attribute.
        Parameters:
        cb - to read from
        Returns:
        new char buffer
        Throws:
        FilterParseException - if the char buffer is empty
      • parseSubstringOrEquality

        private Filter parseSubstringOrEquality​(String attribute,
                                                CharBuffer cb)
                                         throws FilterParseException
        Parses the supplied buffer and returns either a substring or equality filter.
        Parameters:
        attribute - attribute description
        cb - containing the assertion
        Returns:
        either EqualityFilter or SubstringFilter
        Throws:
        FilterParseException - if neither substring or equality syntax can be parsed
      • readSubstrings

        private Map<String,​List<CharBuffer>> readSubstrings​(CharBuffer cb)
                                                           throws FilterParseException
        Reads the supplied buffer and builds a map of the substring data it contains. The following keys are made available in the map:
        • INITIAL: singleton list containing the initial substring or null
        • ANY: list of any substring components or null
        • FINAL: singleton list containing the final substring or null
        • EQUALITY: singleton list containing the equality expression or null
        If the return map contains 'EQUALITY', all other entries will be null and the buffer should be considered an equality assertion.
        Parameters:
        cb - to read
        Returns:
        map of character buffers
        Throws:
        FilterParseException - if an invalid character is encountered
      • parseExtensible

        private ExtensibleFilter parseExtensible​(String attribute,
                                                 CharBuffer cb)
                                          throws FilterParseException
        Parses the supplied buffer and creates an extensible filter.
        Parameters:
        attribute - attribute description or null
        cb - to parse
        Returns:
        extensible filter
        Throws:
        FilterParseException - if the buffer does not contain an extensible expression
      • sliceAtMatch

        private CharBuffer sliceAtMatch​(CharBuffer cb,
                                        char match)
        Returns a new char buffer whose position is 0 and whose limit is before the match character. The supplied buffer has its position incremented one position past the match character.
        Parameters:
        cb - to search
        match - to search for
        Returns:
        new char buffer or null if there is no match