1 20 21 package net.innig.macker.rule.filter; 22 23 import net.innig.macker.rule.*; 24 import net.innig.macker.structure.ClassInfo; 25 import net.innig.macker.structure.PrimitiveTypeInfo; 26 import java.util.Map ; 27 import java.util.List ; 28 29 public class FinalFilter 30 implements Filter 31 { 32 public Pattern createPattern( 33 RuleSet ruleSet, 34 List params, 35 Map options) 36 throws RulesException 37 { 38 if(params.size() != 0) 39 throw new FilterSyntaxException( 40 this, 41 "Filter \"" + options.get("filter") + "\" expects no parameters, but has " + params.size()); 42 return FINAL_PATTERN; 43 } 44 45 private final Pattern FINAL_PATTERN = 46 new Pattern() 47 { 48 public boolean matches(EvaluationContext context, ClassInfo classInfo) 49 throws RulesException 50 { return classInfo.isFinal() && !(classInfo instanceof PrimitiveTypeInfo); } 51 }; 52 } 53 | Popular Tags |