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
-
-
Field Summary
-
Fields inherited from class org.apache.directory.api.ldap.model.filter.LeafNode
attribute, attributeType
-
Fields inherited from class org.apache.directory.api.ldap.model.filter.AbstractExprNode
annotations, assertionType
-
-
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 voidaddAny(String anyPattern)Add an any patternExprNodeclone()Clone the Nodebooleanequals(Object obj)List<String>getAny()Gets the list of wildcard surrounded any fragments.StringgetFinal()Gets the final fragment or suffix.StringgetInitial()Gets the initial fragment.static PatterngetRegex(String initialPattern, String[] anyPattern, String finalPattern)Creates a regular expression from an LDAP substring assertion filter specification.PatterngetRegex(Normalizer normalizer)Gets the compiled regular expression for the substring expression.inthashCode()voidsetAny(List<String> anyPattern)Set the any patternsvoidsetFinal(String finalPattern)Set the final patternvoidsetInitial(String initialPattern)Set the initial patternStringtoString()-
Methods inherited from class org.apache.directory.api.ldap.model.filter.LeafNode
accept, escapeFilterValue, escapeFilterValue, getAttribute, getAttributeType, isLeaf, isSchemaAware, setAttribute, setAttributeType
-
Methods inherited from class org.apache.directory.api.ldap.model.filter.AbstractExprNode
get, getAnnotations, 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:
clonein interfaceExprNode- Overrides:
clonein 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
-
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:
equalsin classLeafNode- Returns:
trueif both objects are equal- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classLeafNode- Returns:
- the instance's hash code
- See Also:
Object.hashCode()
-
toString
public String toString()
- Overrides:
toStringin classAbstractExprNode- Returns:
- A string representing the AndNode
- See Also:
Object.toString()
-
-