1 29 30 package com.caucho.ejb.cfg; 31 32 import com.caucho.bytecode.JClass; 33 import com.caucho.bytecode.JMethod; 34 import com.caucho.ejb.gen.*; 35 import com.caucho.java.gen.BaseMethod; 36 import com.caucho.java.gen.CallChain; 37 import com.caucho.util.L10N; 38 39 import java.util.Collection ; 40 import java.util.Enumeration ; 41 import java.util.Iterator ; 42 43 46 public class EjbEntityFindMethod extends EjbMethod { 47 private static final L10N L = new L10N(EjbEntityFindMethod.class); 48 49 56 public EjbEntityFindMethod(EjbView view, 57 JMethod apiMethod, 58 JMethod implMethod) 59 { 60 super(view, apiMethod, implMethod); 61 } 62 63 70 public EjbEntityFindMethod(EjbView view, JMethod apiMethod) 71 { 72 super(view, apiMethod, null); 73 } 74 75 78 public BaseMethod assemble(ViewClass viewAssembler, String fullClassName) 79 { 80 if (((EjbEntityBean) getView().getBean()).isCMP() && 81 (getImplMethod() == null || 82 getImplMethod().isAbstract())) { 83 return new AmberFindMethod(getApiMethod(), 84 fullClassName, 85 getViewPrefix()); 86 } 87 else if (((EjbEntityBean) getView().getBean()).isCMP1() && 88 (getImplMethod() == null || 89 getImplMethod().isAbstract())) { 90 return new CMP10FindMethod(getApiMethod(), 91 fullClassName, 92 getViewPrefix()); 93 } 94 else { 95 BaseMethod method; 96 97 JClass apiReturnType = getApiMethod().getReturnType(); 98 99 if (apiReturnType.isAssignableTo(Collection .class) || 100 apiReturnType.isAssignableTo(Enumeration .class) || 101 apiReturnType.isAssignableTo(Iterator .class)) 102 method = new EntityFindCollectionMethod(getApiMethod(), 103 getImplMethod(), 104 fullClassName, 105 getViewPrefix()); 106 else 107 method = new EntityFindMethod(getApiMethod(), 108 getImplMethod(), 109 fullClassName, 110 getViewPrefix()); 111 112 CallChain call = method.getCall(); 113 114 if (call != null) { 115 call = new EntityHomeSync(call); 116 call = new EntityHomePoolChain(call); 117 118 method.setCall(assembleCallChain(call)); 119 } 120 121 return method; 122 } 123 } 124 } 125 | Popular Tags |