1 package com.puppycrawl.tools.checkstyle.checks.j2ee; 20 21 import com.puppycrawl.tools.checkstyle.api.Check; 22 import com.puppycrawl.tools.checkstyle.api.DetailAST; 23 import com.puppycrawl.tools.checkstyle.api.TokenTypes; 24 25 29 public abstract class AbstractJ2eeCheck 30 extends Check 31 { 32 33 private MethodChecker mMethodChecker; 34 35 42 protected void log(DetailAST aAST, String aKey, Object [] aArgs) 43 { 44 final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); 45 log(nameAST.getLineNo(), nameAST.getColumnNo(), aKey, aArgs); 46 } 47 48 56 protected void logName(DetailAST aAST, String aKey, Object [] aArgs) 57 { 58 final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); 59 final String name = nameAST.getText(); 60 final Object [] fullArgs = new Object [aArgs.length + 1]; 61 System.arraycopy(aArgs, 0, fullArgs, 1, aArgs.length); 62 fullArgs[0] = name; 63 log( 64 nameAST.getLineNo(), 65 nameAST.getColumnNo(), 66 aKey, 67 fullArgs); 68 } 69 70 74 public MethodChecker getMethodChecker() 75 { 76 return mMethodChecker; 77 } 78 79 83 public void setMethodChecker(MethodChecker aMethodChecker) 84 { 85 mMethodChecker = aMethodChecker; 86 } 87 } 88 | Popular Tags |