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 ContainerManagedMethodChecker 30 extends EntityBeanMethodChecker 31 { 32 36 public ContainerManagedMethodChecker(EntityBeanCheck aCheck) 37 { 38 super(aCheck); 39 } 40 41 44 public void checkMethod(DetailAST aMethodAST) 45 { 46 super.checkMethod(aMethodAST); 47 48 final DetailAST nameAST = aMethodAST.findFirstToken(TokenTypes.IDENT); 49 final String name = nameAST.getText(); 50 51 if (name.startsWith("ejbSelect")) { 52 checkSelectMethod(aMethodAST); 53 } 54 } 55 56 61 protected void checkSelectMethod(DetailAST aMethodAST) 62 { 63 if (!Utils.isPublic(aMethodAST)) { 65 log(aMethodAST, "nonpublic.bean", new Object [] {"Method"}); 66 } 67 if (!Utils.isAbstract(aMethodAST)) { 69 log(aMethodAST, "nonabstract.bean", new Object [] {"Method"}); 70 } 71 checkThrows(aMethodAST, "javax.ejb.FinderException"); 73 } 74 75 80 protected void checkCreateMethod(DetailAST aMethodAST) 81 { 82 super.checkCreateMethod(aMethodAST); 83 84 checkThrows(aMethodAST, "javax.ejb.CreateException"); 86 } 87 } 88 | Popular Tags |