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.primitives.Void; 31 32 33 39 public class EnsureVoidReturnTypeForSessionBeanEjbCreateRule extends InspectorBase { 40 41 public void visit(com.pavelvlasov.jsel.Class clazz) { 42 try { 43 if (clazz.isKindOf("javax.ejb.SessionBean")) { 44 Iterator it=clazz.getFields().iterator(); 45 while (it.hasNext()) { 46 Object o=it.next(); 47 if (o instanceof com.pavelvlasov.jsel.Method) { 48 com.pavelvlasov.jsel.Method method=(com.pavelvlasov.jsel.Method) o; 49 if ("ejbCreate".equals(method.getName()) && !(method.getReturnType().getType() instanceof Void )) { 50 context.reportViolation(method); 51 } 52 } 53 54 } 55 } 56 } catch (JselException e) { 57 context.warn(clazz, e); 58 } 59 } 60 } 61 | Popular Tags |