1 21 22 package org.continuent.sequoia.controller.semantic; 23 24 import java.util.regex.Pattern ; 25 26 33 public class RequestSemantic extends AbstractSemantic 34 { 35 private Pattern sqlPattern; 36 37 42 public RequestSemantic(String sqlRegExp) 43 { 44 this.sqlPattern = Pattern.compile(sqlRegExp, Pattern.CASE_INSENSITIVE 45 | Pattern.DOTALL); 46 } 47 48 54 public boolean matchesPattern(String sql) 55 { 56 return sqlPattern.matcher(sql).matches(); 57 } 58 59 64 public Pattern getSqlPattern() 65 { 66 return sqlPattern; 67 } 68 69 72 public boolean equals(Object obj) 73 { 74 if (obj instanceof RequestSemantic) 75 { 76 RequestSemantic other = (RequestSemantic) obj; 77 return sqlPattern.equals(other.getSqlPattern()); 78 } 79 return false; 80 } 81 82 85 public int hashCode() 86 { 87 return sqlPattern.hashCode(); 88 } 89 90 } 91 | Popular Tags |