Class DefaultFilterFunction

    • Field Detail


        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.
        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 it's position set to the next position after the attribute.
        cb - to read from
        new char buffer
        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.
        attribute - attribute description
        cb - containing the assertion
        either EqualityFilter or SubstringFilter
        FilterParseException - if neither substring or equality syntax can be parsed
      • readSubstrings

        private Map<String,​List<CharBuffer>> readSubstrings​(CharBuffer cb)
        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.
        cb - to read
        map of character buffers
      • parseExtensible

        private ExtensibleFilter parseExtensible​(String attribute,
                                                 CharBuffer cb)
                                          throws FilterParseException
        Parses the supplied buffer and creates an extensible filter.
        attribute - attribute description or null
        cb - to parse
        extensible filter
        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 it's position incremented one position past the match character.
        cb - to search
        match - to search for
        new char buffer or null if there is no match