use of act.asm.Type in project actframework by actframework.
the class JobClassMetaInfoManager method registerJobMetaInfo.
public void registerJobMetaInfo(JobClassMetaInfo metaInfo) {
String className = Type.getObjectType(metaInfo.className()).getClassName();
jobs.put(className, metaInfo);
if (metaInfo.isJob()) {
Type superType = metaInfo.superType();
if (!AsmTypes.OBJECT_TYPE.equals(superType)) {
JobClassMetaInfo superInfo = jobMetaInfo(superType.getClassName());
if (null == superInfo) {
List<JobClassMetaInfo> subTypes = subTypeInfo.get(superType);
if (null == subTypes) {
subTypes = new ArrayList<>();
}
subTypes.add(metaInfo);
}
}
}
List<JobClassMetaInfo> subTypes = subTypeInfo.get(metaInfo.type());
if (null != subTypes) {
subTypeInfo.remove(metaInfo.type());
}
logger.trace("Job meta info registered for: %s", className);
}
use of act.asm.Type in project actframework by actframework.
the class AsmTypesTest method testMethodDescWithoutReturnType.
@Test
public void testMethodDescWithoutReturnType() throws Exception {
Method m = AsmTypesTest.class.getDeclaredMethod("testMethodDescWithoutReturnType");
Type mt = Type.getType(m);
eq(mt.getDescriptor(), AsmTypes.methodDesc(Void.class));
}
use of act.asm.Type in project actframework by actframework.
the class AsmTypesTest method testMethodDescWithParamAndReturnType.
@Test
public void testMethodDescWithParamAndReturnType() throws Exception {
Method m = ActionContext.class.getDeclaredMethod("paramVal", String.class);
Type mt = Type.getType(m);
eq(mt.getDescriptor(), AsmTypes.methodDesc(String.class, String.class));
}
use of act.asm.Type in project actframework by actframework.
the class SingletonEnhancer method visitAnnotation.
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
Type type = Type.getType(desc);
if (Singleton.class.getName().equals(type.getClassName())) {
shouldAddAnnotation = false;
shouldEnhance = true;
}
return super.visitAnnotation(desc, visible);
}
use of act.asm.Type in project actframework by actframework.
the class GenieFactoryFinder method byteCodeVisitor.
@Override
public ByteCodeVisitor byteCodeVisitor() {
return new ByteCodeVisitor() {
private boolean isPublic;
@Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
super.visit(version, access, name, signature, superName, interfaces);
isPublic = AsmTypes.isPublic(access);
isModule = Module.class.getName().equals(Type.getObjectType(superName).getClassName());
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
return !isPublic || isModule || isFactory ? mv : new MethodVisitor(ASM5, mv) {
@Override
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
Type annoType = Type.getType(desc);
if (AsmTypes.PROVIDES.asmType().equals(annoType)) {
isFactory = true;
}
return super.visitAnnotation(desc, visible);
}
};
}
};
}
Aggregations