org.apache.shiro.util
Class RegExPatternMatcher

java.lang.Object
  extended by org.apache.shiro.util.RegExPatternMatcher
All Implemented Interfaces:
PatternMatcher

public class RegExPatternMatcher
extends Object
implements PatternMatcher

PatternMatcher implementation that uses standard java.util.regex objects.

Since:
1.0
See Also:
Pattern

Constructor Summary
RegExPatternMatcher()
           
 
Method Summary
 boolean matches(String pattern, String source)
          Simple implementation that merely uses the default pattern comparison logic provided by the JDK.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegExPatternMatcher

public RegExPatternMatcher()
Method Detail

matches

public boolean matches(String pattern,
                       String source)
Simple implementation that merely uses the default pattern comparison logic provided by the JDK.

This implementation essentially executes the following:

 Pattern p = Pattern.compile(pattern);
 Matcher m = p.matcher(source);
 return m.matches();

Specified by:
matches in interface PatternMatcher
Parameters:
pattern - the pattern to match against
source - the source to match
Returns:
true if the source matches the required pattern, false otherwise.


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.