public class RegularExpressionElement extends AbstractElement
| Modifier and Type | Field and Description | 
|---|---|
static int | 
CASE_INSENSITIVE
Option for case insensitive matching. 
 | 
static int | 
DOT_ALL
Option for dotall mode ('.' matches everything). 
 | 
static int | 
LOCALE_DEPENDENT
Option to make \w, \W, etc. 
 | 
static int | 
MULTILINE
Option for multiline matching. 
 | 
static int | 
OPTION_I
Option for case insensitive matching. 
 | 
static int | 
OPTION_L
Option to make \w, \W, etc. 
 | 
static int | 
OPTION_M
Option for multiline matching. 
 | 
static int | 
OPTION_MASK
Option for verbose mode. 
 | 
static int | 
OPTION_S
Option for dotall mode ('.' matches everything). 
 | 
static int | 
OPTION_U
Option to make \w, \W, etc. 
 | 
static int | 
OPTION_X
Option for verbose mode. 
 | 
protected static int | 
PATTERN_UNICODE
Option to make \w, \W, etc. 
 | 
static ElementType | 
TYPE
The BSON type for a string. 
 | 
static int | 
UNICODE
Option to make \w, \W, etc. 
 | 
static int | 
VERBOSE
Option for verbose mode. 
 | 
ELEMENT_TYPE| Constructor and Description | 
|---|
RegularExpressionElement(String name,
                        Pattern pattern)
Constructs a new  
RegularExpressionElement. | 
RegularExpressionElement(String name,
                        String pattern,
                        int options)
Constructs a new  
RegularExpressionElement. | 
RegularExpressionElement(String name,
                        String pattern,
                        String options)
Constructs a new  
RegularExpressionElement. | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
accept(Visitor visitor)
Accepts the visitor and calls the  
Visitor.visitRegularExpression(java.lang.String, java.lang.String, java.lang.String)
 method. | 
boolean | 
equals(Object object)
Determines if the passed object is of this same type as this object and
 if so that its fields are equal. 
 | 
int | 
getOptions()
Returns the regular expression options. 
 | 
String | 
getPattern()
Returns the regular expression pattern. 
 | 
ElementType | 
getType()
Returns the type for the BSON type. 
 | 
Pattern | 
getValueAsObject()
Returns the value for BSON element as a Java  
Object type. | 
int | 
hashCode()
Computes a reasonable hash code. 
 | 
protected static int | 
optionsAsInt(Pattern pattern)
Converts the  
pattern flags into a options value. | 
protected static int | 
optionsAsInt(String options)
Converts the options string into a options value. 
 | 
RegularExpressionElement | 
withName(String name)
Creates a new element with the same type and value as this element but
 with the specified name. 
 | 
asElement, find, find, findFirst, findFirst, getName, getValueAsString, nullSafeEquals, queryPath, queryPath, toStringpublic static final int CASE_INSENSITIVE
public static final int DOT_ALL
public static final int LOCALE_DEPENDENT
public static final int MULTILINE
public static final int OPTION_I
public static final int OPTION_L
public static final int OPTION_M
public static final int OPTION_MASK
public static final int OPTION_S
public static final int OPTION_U
public static final int OPTION_X
public static final ElementType TYPE
public static final int UNICODE
public static final int VERBOSE
protected static final int PATTERN_UNICODE
public RegularExpressionElement(String name, Pattern pattern)
RegularExpressionElement.name - The name for the BSON string.pattern - The regular expression Pattern.IllegalArgumentException - If the name or pattern is null.public RegularExpressionElement(String name, String pattern, int options)
RegularExpressionElement.name - The name for the BSON string.pattern - The BSON regular expression pattern.options - The BSON regular expression options.IllegalArgumentException - If the name or pattern is null.public RegularExpressionElement(String name, String pattern, String options)
RegularExpressionElement.name - The name for the BSON string.pattern - The BSON regular expression pattern.options - The BSON regular expression options.IllegalArgumentException - If the name or pattern is null.protected static int optionsAsInt(Pattern pattern)
pattern flags into a options value.
 
 Note that the VERBOSE and LOCALE_DEPENDENT do not have
 Pattern equivalent flags.
 
Pattern.CASE_INSENSITIVE==>CASE_INSENSITIVEPattern.MULTILINE==>MULTILINEPattern.DOTALL==>DOT_ALLPattern.UNICODE_CHARACTER_CLASS==>UNICODE
pattern - The pattern to extract the options from.protected static int optionsAsInt(String options)
options - The possibly non-normalized options string.public void accept(Visitor visitor)
Visitor.visitRegularExpression(java.lang.String, java.lang.String, java.lang.String)
 method.visitor - The visitor for the element.Element.accept(Visitor)public boolean equals(Object object)
equals in class AbstractElementobject - The object to compare to.Object.equals(java.lang.Object)public int getOptions()
public String getPattern()
public ElementType getType()
public Pattern getValueAsObject()
Object type.
 
 Automatic conversion from the Object-ified value to an element is
 provided via the DocumentBuilder.add(String, Object) method. Not
 all element types will be successfully converted to the same element
 duing a Element-->Object value-->Element conversion. This cases are noted
 in the appropriate sub-type's JavaDoc.
 
 Sub-types will also overload this method with the appropriate type
 returned. e.g., The
 StringElement.getValueAsObject()
 method signature returns a String.
 
 Returns the Pattern.
 
Object type.public int hashCode()
hashCode in class AbstractElementpublic RegularExpressionElement withName(String name)
 Returns a new RegularExpressionElement.
 
name - The new name for the element.Copyright © 2011-2013 Allanbank Consulting, Inc.. All Rights Reserved.