1 package com.puppycrawl.tools.checkstyle.checks.j2ee; 20 21 import com.puppycrawl.tools.checkstyle.api.DetailAST; 22 import com.puppycrawl.tools.checkstyle.api.TokenTypes; 23 24 29 public class SessionBeanMethodChecker 30 extends BeanMethodChecker 31 { 32 33 private boolean mHasEjbCreate; 34 35 39 public SessionBeanMethodChecker(SessionBeanCheck aCheck) 40 { 41 super(aCheck); 42 } 43 44 47 public void checkMethods(DetailAST aAST) 48 { 49 mHasEjbCreate = false; 50 51 super.checkMethods(aAST); 52 53 if (!mHasEjbCreate) { 55 final DetailAST nameAST = aAST.findFirstToken(TokenTypes.IDENT); 56 final String name = nameAST.getText(); 57 final String arg = "Session bean '" + name + "'"; 58 log( 59 aAST, 60 "missingmethod.bean", 61 new Object [] {arg, "ejbCreate<METHOD>(...)"}); 62 } 63 } 64 65 68 protected void checkCreateMethod(DetailAST aMethodAST) 69 { 70 super.checkCreateMethod(aMethodAST); 71 72 if (Utils.isPublic(aMethodAST) 73 && !Utils.isStatic(aMethodAST) 74 && !Utils.isFinal(aMethodAST) 75 && Utils.isVoid(aMethodAST)) 76 { 77 mHasEjbCreate = true; 78 } 79 80 if (!Utils.isVoid(aMethodAST)) { 82 log(aMethodAST, "nonvoidmethod.bean", new Object [] {}); 83 } 84 } 85 } 86 | Popular Tags |