1 23 package org.hammurapi.inspectors; 24 25 import java.util.Iterator ; 26 27 import org.hammurapi.InspectorBase; 28 29 import com.pavelvlasov.jsel.JselException; 30 import com.pavelvlasov.jsel.Method; 31 32 33 34 40 public class EjbPostCreateModifiersRule extends InspectorBase { 41 42 public void visit(com.pavelvlasov.jsel.Class clazz) { 43 try { 44 if (clazz.isKindOf("javax.ejb.EnterpriseBean")) { 45 Iterator it=clazz.getFields().iterator(); 46 while (it.hasNext()) { 47 Object o=it.next(); 48 if (o instanceof Method) { 49 Method method=(Method) o; 50 if ("ejbPostCreate".equals(method.getName())) { 51 if (method.getModifiers().contains("static")) { 52 context.reportViolation(method); 53 } 54 if (method.getModifiers().contains("final")) { 55 context.reportViolation(method); 56 } 57 if (!method.getModifiers().contains("public")) { 58 context.reportViolation(method); 59 } 60 } 61 } 62 } 63 } 64 } catch (JselException e) { 65 context.warn(clazz, e); 66 } 67 } 68 } 69 | Popular Tags |