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 31 32 38 public class EnsureEjbPostCreateRule extends InspectorBase { 39 40 public void visit(com.pavelvlasov.jsel.Class clazz) { 41 try { 42 if (clazz.isKindOf("javax.ejb.EntityBean")) { 43 Iterator it=clazz.getFields().iterator(); 44 while (it.hasNext()) { 45 Object o=it.next(); 46 if (o instanceof com.pavelvlasov.jsel.Method) { 47 com.pavelvlasov.jsel.Method method=(com.pavelvlasov.jsel.Method) o; 48 if ("ejbCreate".equals(method.getName()) 49 && clazz.getOperationNamespace().find("ejbPost"+method.getOperationSignature().substring(3))==null) 50 { 51 52 context.reportViolation(method); 53 } 54 } 55 56 } 57 } 58 } catch (JselException e) { 59 context.warn(clazz, e); 60 } 61 } 62 } 63 | Popular Tags |