Class SubstringNode
- java.lang.Object
-
- org.apache.directory.api.ldap.model.filter.AbstractExprNode
-
- org.apache.directory.api.ldap.model.filter.LeafNode
-
- org.apache.directory.api.ldap.model.filter.SubstringNode
-
public class SubstringNode extends LeafNode
Filter expression tree node used to represent a substring assertion.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description SubstringNode(String attributeType)
Creates a new SubstringNode object without any valueSubstringNode(String attribute, String initialPattern, String finalPattern)
Creates a new SubstringNode object with only one wildcard and no internal any fragments between wildcards.SubstringNode(List<String> anyPattern, String attribute, String initialPattern, String finalPattern)
Creates a new SubstringNode object more than one wildcard and an any list.SubstringNode(List<String> anyPattern, AttributeType attributeType, String initialPattern, String finalPattern)
Creates a new SubstringNode object more than one wildcard and an any list.SubstringNode(AttributeType attribute)
Creates a new SubstringNode object without any valueSubstringNode(AttributeType attributeType, String initialPattern, String finalPattern)
Creates a new SubstringNode object with only one wildcard and no internal any fragments between wildcards.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAny(String anyPattern)
Add an any patternExprNode
clone()
Clone the Nodeboolean
equals(Object obj)
List<String>
getAny()
Gets the list of wildcard surrounded any fragments.String
getFinal()
Gets the final fragment or suffix.String
getInitial()
Gets the initial fragment.static Pattern
getRegex(String initialPattern, String[] anyPattern, String finalPattern)
Creates a regular expression from an LDAP substring assertion filter specification.Pattern
getRegex(Normalizer normalizer)
Gets the compiled regular expression for the substring expression.int
hashCode()
void
setAny(List<String> anyPattern)
Set the any patternsvoid
setFinal(String finalPattern)
Set the final patternvoid
setInitial(String initialPattern)
Set the initial patternString
toString()
-
Methods inherited from class org.apache.directory.api.ldap.model.filter.LeafNode
accept, getAttribute, getAttributeType, isLeaf, isSchemaAware, setAttribute, setAttributeType
-
Methods inherited from class org.apache.directory.api.ldap.model.filter.AbstractExprNode
get, getAssertionType, printRefinementToBuffer, set
-
-
-
-
Constructor Detail
-
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 assertinitialPattern
- the initial fragmentfinalPattern
- 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 assertinitialPattern
- the initial fragmentfinalPattern
- 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 wildcardsattributeType
- the attributeType to substring assertinitialPattern
- the initial fragmentfinalPattern
- 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 wildcardsattribute
- the name of the attribute to substring assertinitialPattern
- the initial fragmentfinalPattern
- the final fragment
-
-
Method Detail
-
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 wildcardsanyPattern
- fragments surrounded by wildcards if anyfinalPattern
- 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 interfaceExprNode
- Overrides:
clone
in classAbstractExprNode
- 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
-
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 classLeafNode
- Returns:
true
if both objects are equal- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classLeafNode
- Returns:
- the instance's hash code
- See Also:
Object.hashCode()
-
toString
public String toString()
- Overrides:
toString
in classAbstractExprNode
- Returns:
- A string representing the AndNode
- See Also:
Object.toString()
-
-