Class SubstringNode

All Implemented Interfaces:
Cloneable, ExprNode

public class SubstringNode extends LeafNode
Filter expression tree node used to represent a substring assertion.
Author:
Apache Directory Project
  • Constructor Details

    • SubstringNode

      public SubstringNode(AttributeType attributeType, String initialPattern, String finalPattern)
      Creates a new SubstringNode object with only one wildcard and no internal any fragments between wildcards.
      Parameters:
      attributeType - the name of the attributeType to substring assert
      initialPattern - the initial fragment
      finalPattern - the final fragment
    • SubstringNode

      public SubstringNode(String attribute, String initialPattern, String finalPattern)
      Creates a new SubstringNode object with only one wildcard and no internal any fragments between wildcards.
      Parameters:
      attribute - the name of the attribute to substring assert
      initialPattern - the initial fragment
      finalPattern - the final fragment
    • SubstringNode

      public SubstringNode(AttributeType attribute)
      Creates a new SubstringNode object without any value
      Parameters:
      attribute - the name of the attribute to substring assert
    • SubstringNode

      public SubstringNode(String attributeType)
      Creates a new SubstringNode object without any value
      Parameters:
      attributeType - the attributeType to substring assert
    • SubstringNode

      public SubstringNode(List<String> anyPattern, AttributeType attributeType, String initialPattern, String finalPattern)
      Creates a new SubstringNode object more than one wildcard and an any list.
      Parameters:
      anyPattern - list of internal fragments between wildcards
      attributeType - the attributeType to substring assert
      initialPattern - the initial fragment
      finalPattern - the final fragment
    • SubstringNode

      public SubstringNode(List<String> anyPattern, String attribute, String initialPattern, String finalPattern)
      Creates a new SubstringNode object more than one wildcard and an any list.
      Parameters:
      anyPattern - list of internal fragments between wildcards
      attribute - the name of the attribute to substring assert
      initialPattern - the initial fragment
      finalPattern - the final fragment
  • Method Details

    • getRegex

      public static Pattern getRegex(String initialPattern, String[] anyPattern, String finalPattern)
      Creates a regular expression from an LDAP substring assertion filter specification.
      Parameters:
      initialPattern - the initial fragment before wildcards
      anyPattern - fragments surrounded by wildcards if any
      finalPattern - the final fragment after last wildcard if any
      Returns:
      the regular expression for the substring match filter
      Throws:
      PatternSyntaxException - if a syntactically correct regular expression cannot be compiled
    • clone

      public ExprNode clone()
      Clone the Node
      Specified by:
      clone in interface ExprNode
      Overrides:
      clone in class AbstractExprNode
      Returns:
      the cloned expression node
    • getInitial

      public final String getInitial()
      Gets the initial fragment.
      Returns:
      the initial prefix
    • setInitial

      public void setInitial(String initialPattern)
      Set the initial pattern
      Parameters:
      initialPattern - The initial pattern
    • getFinal

      public final String getFinal()
      Gets the final fragment or suffix.
      Returns:
      the suffix
    • setFinal

      public void setFinal(String finalPattern)
      Set the final pattern
      Parameters:
      finalPattern - The final pattern
    • getAny

      public final List<String> getAny()
      Gets the list of wildcard surrounded any fragments.
      Returns:
      the any fragments
    • setAny

      public void setAny(List<String> anyPattern)
      Set the any patterns
      Parameters:
      anyPattern - The any patterns
    • addAny

      public void addAny(String anyPattern)
      Add an any pattern
      Parameters:
      anyPattern - The any pattern
    • getRegex

      public final Pattern getRegex(Normalizer normalizer) throws LdapException
      Gets the compiled regular expression for the substring expression.
      Parameters:
      normalizer - the normalizer to use for pattern component normalization
      Returns:
      the equivalent compiled regular expression
      Throws:
      LdapException - if there are problems while normalizing
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class LeafNode
      Returns:
      true if both objects are equal
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class LeafNode
      Returns:
      the instance's hash code
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class AbstractExprNode
      Returns:
      A string representing the AndNode
      See Also: