public final class SimonPattern extends Object implements SimonFilter
Manager.ROOT_SIMON_NAME (root Simon)
* - matches anything
something - matches exactly something
*something - matches if tested name ends with something
something* - matches if tested name starts with something
*something* - matches if tested name contains something anywhere
something*else - matches if tested name starts with something and ends with else
SimonException with the message about invalid Simon pattern
ACCEPT_ALL_FILTER| Constructor and Description |
|---|
SimonPattern(String pattern)
Creates Simon name pattern used to match config file entries.
|
SimonPattern(String pattern,
Class<? extends Simon> expectedType)
Creates Simon pattern that used to match Simons of specified type with names that correspond to
the pattern.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(Simon simon)
Checks whether current Simon should be used/considered.
|
static SimonPattern |
create(String pattern)
Factory method that creates Simon name pattern - or returns
null if parameter is null. |
static SimonPattern |
createForCounter(String pattern)
Factory method that creates Counter name pattern - or returns a pattern
that accepts all Counters if parameter is
null. |
static SimonPattern |
createForStopwatch(String pattern)
Factory method that creates Stopwatch name pattern - or returns a pattern
that accepts all Stopwatches if parameter is
null. |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
matches(String name)
Checks if Simon name matches this pattern.
|
String |
toString() |
public SimonPattern(String pattern)
pattern - Simon name patternSimonException - if pattern is not valid (runtime exception)public SimonPattern(String pattern, Class<? extends Simon> expectedType)
pattern - Simon name patternexpectedType - expected type of SimonSimonException - if pattern is not valid (runtime exception)public static SimonPattern create(String pattern)
null if parameter is null.pattern - Simon name pattern as stringnull if pattern parameter is nullpublic static SimonPattern createForCounter(String pattern)
null.pattern - Counter name pattern as stringpublic static SimonPattern createForStopwatch(String pattern)
null.pattern - Stopwatch name pattern as stringpublic boolean accept(Simon simon)
SimonFilteraccept in interface SimonFiltersimon - Simon to checkpublic boolean matches(String name)
name - tested nameCopyright © 2019. All rights reserved.