|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.edugility.objexj.Pattern<T>
T
- the type of Object
a Pattern
can matchpublic class Pattern<T>
A regular expression pattern for arbitrary Object
s.
A Pattern
encapsulates the rules by which List
s
of objects—the input—are matched or rejected.
Pattern
s are compiled from textual representations that
bear a striking and intentional similarity to regular regular
expressions.
A normal user interaction with this class might consist of code like the following:
finalPattern
p = Pattern. compile
("^javax.persistence.PersistenceException/java.lang.Throwable*"); assert p != null; finalMatcher
<Exception
> matcher = p.matcher
(listOfExceptions); assert matcher != null; // Call matcher.lookingAt()
or....
Pattern
s are not safe for use by multiple Java
threads.
compile(String)
,
matcher(List)
,
Matcher
,
Syntax
GuideMethod Summary | ||
---|---|---|
static
|
compile(String source)
Compiles a new Pattern from the supplied source code. |
|
Matcher<T> |
matcher(List<? extends T> items)
Returns a Matcher initialized to match the supplied
List of items. |
|
String |
toString()
Returns a non- null String representation of this
Pattern . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public final Matcher<T> matcher(List<? extends T> items)
Matcher
initialized to match the supplied
List
of items. This method never returns null
.
items
- the input; may be null
Matcher
; never null
public String toString()
null
String
representation of this
Pattern
.
This implementation attempts to return the original source
code used to produce this Pattern
. If that fails for
some reason, then the normal Object.toString()
method
return value is returned instead.
toString
in class Object
null
String
representation of this
Pattern
public static final <T> Pattern<T> compile(String source) throws IOException, ParseException
Pattern
from the supplied source code.
T
- the type of Object
the resulting Pattern
will be capable of producing Matcher
s forsource
- the source code for the Pattern
; must not
be null
null
Pattern
IllegalArgumentException
- if source
is null
IOException
- if the source code could not be compiled
because the source code could not be physically read for some
reason
ParseException
- if the source code could be read but
was syntactically invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |