1 29 30 package com.caucho.ejb.gen; 31 32 import com.caucho.bytecode.JClass; 33 import com.caucho.ejb.cfg.EjbBean; 34 import com.caucho.java.gen.BaseMethod; 35 import com.caucho.java.gen.ClassComponent; 36 import com.caucho.java.gen.DependencyComponent; 37 import com.caucho.java.gen.GenClass; 38 import com.caucho.util.L10N; 39 import com.caucho.vfs.PersistentDependency; 40 41 44 abstract public class BeanAssembler { 45 private static final L10N L = new L10N(BeanAssembler.class); 46 47 private EjbBean _bean; 48 49 protected GenClass _genClass; 50 protected GenClass _beanClass; 51 52 protected DependencyComponent _dependency; 53 54 public BeanAssembler(EjbBean bean, 55 String fullClassName) 56 { 57 _bean = bean; 58 _genClass = new GenClass(fullClassName); 59 _dependency = new DependencyComponent(); 60 _genClass.addComponent(_dependency); 61 } 62 63 66 public String getShortClassName() 67 { 68 return _genClass.getClassName(); 69 } 70 71 74 public GenClass getAssembledGenerator() 75 { 76 return _genClass; 77 } 78 79 82 public void addImport(String importName) 83 { 84 _genClass.addImport(importName); 85 } 86 87 90 public void addHeaderComponent(JClass beanClass, 91 String contextClassName, 92 String implClassName) 93 { 94 } 95 96 99 public void addMethod(BaseMethod method) 100 { 101 addComponent(method); 102 } 103 104 107 public void addComponent(ClassComponent component) 108 { 109 } 110 111 114 public void addDependency(PersistentDependency depend) 115 { 116 _dependency.addDependency(depend); 117 } 118 119 122 abstract public ViewClass createHomeView(JClass homeClass, 123 String fullClassName, 124 String viewPrefix); 125 126 129 abstract public ViewClass createView(JClass homeClass, 130 String fullClassName, 131 String viewPrefix); 132 133 136 public static boolean hasMethod(JClass cl, String methodName, JClass []args) 137 { 138 return cl.getMethod(methodName, args) != null; 139 } 140 } 141 | Popular Tags |