org.javasimon
Class SimonPattern

java.lang.Object
  extended by org.javasimon.SimonPattern

public final class SimonPattern
extends Object

Matches Simon name patterns from configuration. Patterns can contain wildcard (*) that can be placed in following fashions:

Without wildcard exact match is required. Every wildcarded pattern always matches with the same string without wildcards (in other words - wildcards matches with nothing as well).


Field Summary
private  String all
          Used if complete match is expected.
private  String end
          Used if tail should match.
private static String INVALID_PATTERN
           
private  String middle
          Used if anything inside (or everything) should match.
private  String pattern
          Original pattern from the configuration.
private  String start
          Used if head should match.
private static String WILDCARD_STAR
           
 
Constructor Summary
SimonPattern(String pattern)
          Creates Simon name pattern used to match config file entries.
 
Method Summary
static SimonPattern create(String pattern)
          Factory method that creates Simon name pattern - or returns null if parameter is null.
 boolean equals(Object o)
           
 int hashCode()
           
 boolean matches(String name)
          Checks if Simon name matches this pattern.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

WILDCARD_STAR

private static final String WILDCARD_STAR
See Also:
Constant Field Values

pattern

private String pattern
Original pattern from the configuration.


all

private String all
Used if complete match is expected.


start

private String start
Used if head should match.


end

private String end
Used if tail should match.


middle

private String middle
Used if anything inside (or everything) should match.


INVALID_PATTERN

private static final String INVALID_PATTERN
See Also:
Constant Field Values
Constructor Detail

SimonPattern

public SimonPattern(String pattern)
Creates Simon name pattern used to match config file entries.

Parameters:
pattern - Simon name pattern
Throws:
SimonException - if pattern is not valid (runtime exception)
Method Detail

create

public static SimonPattern create(String pattern)
Factory method that creates Simon name pattern - or returns null if parameter is null.

Parameters:
pattern - Simon name pattern as string
Returns:
Simon name pattern or null if pattern parameter is null

matches

public boolean matches(String name)
Checks if Simon name matches this pattern.

Parameters:
name - tested name
Returns:
true if tested pattern matches this pattern

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.