Package com.caplin.datasource.namespace
Class RegexNamespace
java.lang.Object
com.caplin.datasource.namespace.RegexNamespace
- All Implemented Interfaces:
Namespace
The
RegexNamespace matches a subject based on one or more regex patterns.
Regex is an abbreviation for "regular expression". Regular expression libraries provide rich string matching
capabilities based upon string patterns ("regular expressions"). Different regular expression libraries vary in their
syntax and functionality. This class uses the library provided by the Java Pattern class.
RegexNamespace can contain include regex patterns and exclude patterns. A subject
matches a RegexNamespace if it matches at least one of the namespace's include regex patterns and
does not match any of its exclude patterns.
-
Constructor Summary
ConstructorsConstructorDescriptionInitializes an empty new instance of theRegexNamespaceclass.RegexNamespace(String includeRegex) Initializes a new instance of theRegexNamespaceclass with an include regex pattern. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExcludeRegex(String regex) Adds an exclude regex pattern to the namespace.voidaddIncludeRegex(String regex) Adds an include regex pattern to the namespace.booleanTests aStringto see if it falls within thisNamespace.toString()
-
Constructor Details
-
RegexNamespace
public RegexNamespace()Initializes an empty new instance of theRegexNamespaceclass. This instance will match no subjects unless one or more regex patterns are first added to the instance via theaddIncludeRegex(String)method. -
RegexNamespace
Initializes a new instance of theRegexNamespaceclass with an include regex pattern.- Parameters:
includeRegex- A regex defining an include pattern.
-
-
Method Details
-
addIncludeRegex
Adds an include regex pattern to the namespace.- Parameters:
regex- A regex defining an include pattern.
-
addExcludeRegex
Adds an exclude regex pattern to the namespace.- Parameters:
regex- A regex defining an exclude pattern.
-
match
Tests aStringto see if it falls within thisNamespace. -
toString
-