Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 49   Methods: 5
NCLOC: 40   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NamePatternInterceptorFilter.java 100% 100% 100% 100%
coverage
 1    package net.sf.crispy.filter;
 2   
 3    import net.sf.crispy.InterceptorFilterContext;
 4   
 5    public class NamePatternInterceptorFilter extends AbstractInterceptorFilter {
 6   
 7    private String pattern = null;
 8   
 9   
 10  9 public NamePatternInterceptorFilter(String pvPattern, int pvFilterType) {
 11  9 setPattern(pvPattern);
 12  9 filterObjectsType = pvFilterType;
 13    }
 14   
 15  9 public final void setPattern(String pvPattern) { pattern = pvPattern; }
 16  50 public String getPattern() { return pattern; }
 17   
 18  22 public boolean accept(InterceptorFilterContext pvContext) {
 19  22 boolean ret = false;
 20  22 switch (filterObjectsType) {
 21  3 case FILTER_TYPE_METHOD:
 22  3 if (pvContext.getMethod() != null) {
 23  2 ret = matches(pvContext.getMethod().getName());
 24    }
 25  3 break;
 26  12 case FILTER_TYPE_CLASS:
 27  12 ret = matches(pvContext.getInvocationClass().getName());
 28  12 break;
 29  5 case FILTER_TYPE_THROWABLE:
 30  5 if (pvContext.getThrowable() != null) {
 31  4 ret = matches(pvContext.getThrowable().getClass().getName());
 32    }
 33  5 break;
 34  2 default:
 35  2 ret = false;
 36  2 break;
 37    }
 38  22 return negate(ret);
 39    }
 40   
 41  18 private boolean matches(String pvName) {
 42  18 boolean ret = true;
 43  18 if ((getPattern() != null) && (getPattern().length() > 0)) {
 44  16 ret = pvName.matches(getPattern());
 45    }
 46  18 return ret;
 47    }
 48   
 49    }