Package de.unkrig.ref4j
Class PatternFactory
java.lang.Object
de.unkrig.ref4j.PatternFactory
- Direct Known Subclasses:
PatternFactory
A facade or abstraction for various regular expression frameworks.
To get
ServiceLoader<PatternFactory> patternFactory = ServiceLoader.load(PatternFactory.class);
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompiles the given regex into aPattern
.abstract Pattern
Compiles the given regex into aPattern
with the given flags.static PatternFactory
get()
Returns the pattern factory configured in this JVM.static PatternFactory
abstract String
getId()
abstract int
abstract boolean
matches
(String regex, CharSequence input)
-
Constructor Details
-
PatternFactory
public PatternFactory()
-
-
Method Details
-
get
Returns the pattern factory configured in this JVM.- The class named by the system property "de.unkrig.ref4j.PatternFactory" (if the system property is set and the class is registered as a pattern factory)
- The first of all registered pattern factories on the classpath (if any)
-
The
java.util.regex
pattern factory
- See Also:
-
EnhancedServiceLoader.load(Class)
-
getId
- Returns:
- A package name-like string that is unique among all existing pattern factory implementations
-
get
- Returns:
- The class that has the given name and extends the
PatternFactory
class
-
getSupportedFlags
public abstract int getSupportedFlags()- Returns:
- The union of all flags supported by
this
engine.
-
compile
Compiles the given regex into aPattern
.- Throws:
PatternSyntaxException
-
compile
Compiles the given regex into aPattern
with the given flags.- Parameters:
flags
- The or'ed compilation flag constants declared byPattern
- Throws:
IllegalArgumentException
- A flag was given that is not set ingetSupportedFlags()
PatternSyntaxException
- See Also:
-
matches
- See Also:
-
quote
- See Also:
-
quoteReplacement
- See Also:
-