org.ijsberg.iglu.util.formatting
Class PatternMatchingSupport

java.lang.Object
  extended by org.ijsberg.iglu.util.formatting.PatternMatchingSupport

public abstract class PatternMatchingSupport
extends Object

Helper class that validates formats of values.


Constructor Summary
PatternMatchingSupport()
           
 
Method Summary
static boolean valueMatchesRegularExpression(String val, Pattern regexp)
          Returns true only if the value matches the regular expression only once and exactly.
static boolean valueMatchesRegularExpression(String val, String regexp)
          Returns true only if the value matches the regular expression only once and exactly.
static boolean valueMatchesWildcardExpression(String val, String exp)
          Matches DOS-type wildcardexpressions rather than regular expressions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternMatchingSupport

public PatternMatchingSupport()
Method Detail

valueMatchesRegularExpression

public static boolean valueMatchesRegularExpression(String val,
                                                    String regexp)
Returns true only if the value matches the regular expression only once and exactly.

Parameters:
val - string value that may match the expression
regexp - regular expression
Returns:
true if val matches regular expression regexp

valueMatchesRegularExpression

public static boolean valueMatchesRegularExpression(String val,
                                                    Pattern regexp)
Returns true only if the value matches the regular expression only once and exactly.

Parameters:
val - string value that may match the expression
regexp - regular expression
Returns:
true if val matches regular expression regexp

valueMatchesWildcardExpression

public static boolean valueMatchesWildcardExpression(String val,
                                                     String exp)
Matches DOS-type wildcardexpressions rather than regular expressions. The function adds one little but handy feature of regular expressions: The '|'-character is regarded as a boolean OR that separates multiple expressions.

Parameters:
val - string value that may match the expression
exp - expression that may contain wild cards
Returns:


Copyright © 2011. All Rights Reserved.