1 4 package com.tc.aspectwerkz.transform.inlining.spi; 5 6 import com.tc.asm.ClassWriter; 7 import com.tc.asm.MethodVisitor; 8 import com.tc.asm.Type; 9 import com.tc.asm.ClassVisitor; 10 11 import com.tc.aspectwerkz.definition.AspectDefinition; 12 import com.tc.aspectwerkz.transform.JoinPointCompiler; 13 import com.tc.aspectwerkz.transform.inlining.AdviceMethodInfo; 14 import com.tc.aspectwerkz.transform.inlining.AspectInfo; 15 import com.tc.aspectwerkz.transform.inlining.compiler.CompilationInfo; 16 import com.tc.aspectwerkz.transform.inlining.compiler.CompilerInput; 17 import com.tc.aspectwerkz.reflect.ClassInfo; 18 19 33 public interface AspectModel { 34 35 41 AspectModel getInstance(CompilationInfo.Model compilationModel); 42 43 49 String getAspectModelType(); 50 51 58 void defineAspect(ClassInfo aspectClassInfo, AspectDefinition aspectDef, ClassLoader loader); 59 60 65 AroundClosureClassInfo getAroundClosureClassInfo(); 66 67 73 void createMandatoryMethods(ClassWriter cw, JoinPointCompiler compiler); 74 75 84 void createInvocationOfAroundClosureSuperClass(MethodVisitor cv); 85 86 95 void createAndStoreStaticAspectInstantiation(ClassVisitor cw, MethodVisitor cv, AspectInfo aspectInfo, String joinPointClassName); 96 97 107 void createAndStoreRuntimeAspectInstantiation(final MethodVisitor cv, 108 final CompilerInput input, 109 final AspectInfo aspectInfo); 110 111 118 void loadAspect(final MethodVisitor cv, 119 final CompilerInput input, 120 final AspectInfo aspectInfo); 121 122 128 void createAroundAdviceArgumentHandling(MethodVisitor cv, 129 CompilerInput input, 130 Type[] joinPointArgumentTypes, 131 AdviceMethodInfo adviceMethodInfo); 132 133 143 public void createBeforeOrAfterAdviceArgumentHandling(MethodVisitor cv, 144 CompilerInput input, 145 Type[] joinPointArgumentTypes, 146 AdviceMethodInfo adviceMethodInfo, 147 int specialArgIndex); 148 149 155 boolean requiresReflectiveInfo(); 156 157 162 public static class AroundClosureClassInfo { 163 164 private final String m_superClassName; 165 166 private final String [] m_interfaceNames; 167 168 public AroundClosureClassInfo(final String superClassName, final String [] interfaceNames) { 169 if (superClassName != null) { 170 m_superClassName = superClassName.replace('.', '/'); 171 } else { 172 m_superClassName = null; 173 } 174 m_interfaceNames = new String [interfaceNames.length]; 175 for (int i = 0; i < interfaceNames.length; i++) { 176 m_interfaceNames[i] = interfaceNames[i].replace('.', '/'); 177 } 178 } 179 180 public String getSuperClassName() { 181 return m_superClassName; 182 } 183 184 public String [] getInterfaceNames() { 185 return m_interfaceNames; 186 } 187 188 191 public static class Type { 192 public static final Type INTERFACE = new Type("INTERFACE"); 193 public static final Type CLASS = new Type("CLASS"); 194 private final String m_name; 195 196 private Type(String name) { 197 m_name = name; 198 } 199 200 public String toString() { 201 return m_name; 202 } 203 } 204 205 } 206 } 207 | Popular Tags |