1 7 package fr.jayasoft.ivy.matcher; 8 9 public final class ExactPatternMatcher implements PatternMatcher { 10 11 public static class ExactMatcher implements Matcher { 12 protected String _exp; 13 14 public ExactMatcher(String exp) { 15 _exp = exp; 16 } 17 18 public boolean matches(String str) { 19 return str == null ? _exp == null : str.equals(_exp); 20 } 21 22 public boolean isExact() { 23 return true; 24 } 25 } 26 27 private static final ExactPatternMatcher INSTANCE = new ExactPatternMatcher(); 28 public static PatternMatcher getInstance() { 29 return INSTANCE; 30 } 31 32 private ExactPatternMatcher() { 33 } 34 35 public String getName() { 36 return EXACT; 37 } 38 39 public Matcher getMatcher(String exp) { 40 if (ANY_EXPRESSION.equals(exp)) { 41 return AnyMatcher.getInstance(); 42 } 43 return new ExactMatcher(exp); 44 } 45 } 46 | Popular Tags |