1 23 24 package com.sun.enterprise.admin.util; 25 26 import java.util.regex.Pattern ; 27 import java.util.regex.Matcher ; 28 29 import com.sun.enterprise.admin.util.SOMLocalStringsManager; 31 32 public class RegExpMatcher implements IPatternMatcher 33 { 34 private String mPatternString = null; 35 private String mTestString = null; 36 37 private static SOMLocalStringsManager localizedStrMgr = 39 SOMLocalStringsManager.getManager( RegExpMatcher.class ); 40 41 44 45 public RegExpMatcher(String patternString, String testString) 46 { 47 if (patternString == null || testString == null) 48 { 49 String msg = localizedStrMgr.getString( "admin.util.regexpmatcher_null_arg" ); 50 throw new IllegalArgumentException ( msg ); 51 } 52 mPatternString = patternString; 53 mTestString = testString; 54 } 55 56 public boolean matches() 57 { 58 Pattern strPattern = Pattern.compile(mPatternString); 59 Matcher matcher = strPattern.matcher(mTestString); 60 61 return ( matcher.matches() ); 62 } 63 } 64 | Popular Tags |