Class PatternMatcher<S>
- java.lang.Object
- org.springframework.batch.support.PatternMatcher<S>
public class PatternMatcher<S> extends java.lang.Object- Author:
- Dave Syer, Dan Garrette
Constructor Summary
Constructors Constructor Description PatternMatcher(java.util.Map<java.lang.String,S> map)Initialize a newPatternMatcherwith a map of patterns to values
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Smatch(java.lang.String line)This method takes a String key and a map from Strings to values of any type.static booleanmatch(java.lang.String pattern, java.lang.String str)Lifted from AntPathMatcher in Spring Core.
Constructor Detail
PatternMatcher
public PatternMatcher(java.util.Map<java.lang.String,S> map)
Initialize a newPatternMatcherwith a map of patterns to values- Parameters:
map- a map from String patterns to values
Method Detail
match
public static boolean match(java.lang.String pattern, java.lang.String str)Lifted from AntPathMatcher in Spring Core. Tests whether or not a string matches against a pattern. The pattern may contain two special characters:
'*' means zero or more characters
'?' means one and only one character- Parameters:
pattern- pattern to match against. Must not benull.str- string which must be matched against the pattern. Must not benull.- Returns:
trueif the string matches against the pattern, orfalseotherwise.
match
public S match(java.lang.String line)
This method takes a String key and a map from Strings to values of any type. During processing, the method will identify the most specific key in the map that matches the line. Once the correct is identified, its value is returned. Note that if the map contains the wildcard string "*" as a key, then it will serve as the "default" case, matching every line that does not match anything else.
If no matching prefix is found, a
IllegalStateExceptionwill be thrown.Null keys are not allowed in the map.
- Parameters:
line- An input string- Returns:
- the value whose prefix matches the given line