本文整理汇总了Java中org.springframework.asm.Type.getType方法的典型用法代码示例。如果您正苦于以下问题:Java Type.getType方法的具体用法?Java Type.getType怎么用?Java Type.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.asm.Type
的用法示例。
在下文中一共展示了Type.getType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateConstructor
import org.springframework.asm.Type; //导入方法依赖的package包/类
private void generateConstructor(Object[] arrays) {
CodeEmitter e = begin_method(Constants.ACC_PUBLIC, CSTRUCT_OBJECT_ARRAY, null);
e.load_this();
e.super_invoke_constructor();
e.load_this();
e.load_arg(0);
e.super_putfield("a", Constants.TYPE_OBJECT_ARRAY);
for (int i = 0; i < arrays.length; i++) {
Type type = Type.getType(arrays[i].getClass());
declare_field(Constants.ACC_PRIVATE, getFieldName(i), type, null);
e.load_this();
e.load_arg(0);
e.push(i);
e.aaload();
e.checkcast(type);
e.putfield(getFieldName(i));
}
e.return_value();
e.end_method();
}
示例2: createHandleMessageMethod
import org.springframework.asm.Type; //导入方法依赖的package包/类
private void createHandleMessageMethod(ClassEmitter classEmitter) {
Signature signature = new Signature(
"handleMessage", Type.VOID_TYPE, new Type[] { MESSAGE_TYPE });
Signature subscriberMethodSignature = new Signature(
subscriberInfo.getSubscriberMethodName(),
Type.VOID_TYPE,
new Type[] { Type.getType(subscriberInfo.getEventType()) });
CodeEmitter emitter = classEmitter.begin_method(Constants.ACC_PUBLIC, signature, null);
emitter.load_this();
emitter.getfield("delegate");
emitter.load_arg(0);
emitter.invoke_interface(MESSAGE_TYPE, GETPAYLOAD_SIGNATURE);
emitter.checkcast(Type.getType(subscriberInfo.getEventType()));
emitter.invoke_virtual(Type.getType(subscriberInfo.getBeanClass()), subscriberMethodSignature);
emitter.return_value();
emitter.end_method();
}
开发者ID:unbroken-dome,项目名称:spring-integration-eventbus,代码行数:21,代码来源:CglibSubscriberProxyClassGenerator.java
示例3: beginClass
import org.springframework.asm.Type; //导入方法依赖的package包/类
private void beginClass() {
Type supperType = Type.getType(entityType);
Type[] interfaceTypes = new Type[] { Type.getType(Serializable.class), Type.getType(HibatisEntity.class) };
this.emitter.begin_class(Opcodes.V1_5, Opcodes.ACC_PUBLIC, proxyClassName, supperType, interfaceTypes,
null);
addConstructor();
}
示例4: generateSwap
import org.springframework.asm.Type; //导入方法依赖的package包/类
private void generateSwap(final Object[] arrays) {
CodeEmitter e = begin_method(Constants.ACC_PUBLIC, SWAP, null);
for (int i = 0; i < arrays.length; i++) {
Type type = Type.getType(arrays[i].getClass());
Type component = TypeUtils.getComponentType(type);
Local T = e.make_local(type);
e.load_this();
e.getfield(getFieldName(i));
e.store_local(T);
e.load_local(T);
e.load_arg(0);
e.load_local(T);
e.load_arg(1);
e.array_load(component);
e.load_local(T);
e.load_arg(1);
e.load_local(T);
e.load_arg(0);
e.array_load(component);
e.array_store(component);
e.array_store(component);
}
e.return_value();
e.end_method();
}
示例5: createConstructor
import org.springframework.asm.Type; //导入方法依赖的package包/类
private void createConstructor(ClassEmitter classEmitter) {
Signature signature = new Signature(
Constants.CONSTRUCTOR_NAME, Type.VOID_TYPE,
new Type[] { Type.getType(subscriberInfo.getBeanClass()) });
CodeEmitter emitter = classEmitter.begin_method(Constants.ACC_PUBLIC, signature, null);
emitter.load_this();
emitter.dup();
emitter.super_invoke_constructor();
emitter.load_arg(0);
emitter.putfield("delegate");
emitter.return_value();
emitter.end_method();
}
开发者ID:unbroken-dome,项目名称:spring-integration-eventbus,代码行数:15,代码来源:CglibSubscriberProxyClassGenerator.java
示例6: putEnumField
import org.springframework.asm.Type; //导入方法依赖的package包/类
private void putEnumField(CodeEmitter e, String name, Enum<?> value) {
Type type = Type.getType(value.getClass());
e.visitVarInsn(Opcodes.ALOAD, 0);
e.getstatic(type, value.name(), type);
e.visitFieldInsn(Opcodes.PUTFIELD, proxyClassPath, name, type.getDescriptor());
}
示例7: generateClass
import org.springframework.asm.Type; //导入方法依赖的package包/类
public void generateClass(ClassVisitor v) {
Type targetType = Type.getType(target);
ClassEmitter ce = new ClassEmitter(v);
ce.begin_class(Constants.V1_6,
Constants.ACC_PUBLIC | Constants.ACC_SUPER,
getClassName(),
targetType,
null,
Constants.SOURCE_FILE);
ce.declare_field(Constants.ACC_FINAL | Constants.ACC_PRIVATE, FIELD_NAME, targetType, null);
CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, CSTRUCT_OBJECT, null);
e.load_this();
e.super_invoke_constructor();
e.load_this();
e.load_arg(0);
e.checkcast(targetType);
e.putfield(FIELD_NAME);
e.return_value();
e.end_method();
PropertyDescriptor[] descriptors = ReflectUtils.getBeanProperties(target);
Method[] getters = ReflectUtils.getPropertyMethods(descriptors, true, false);
Method[] setters = ReflectUtils.getPropertyMethods(descriptors, false, true);
for (int i = 0; i < getters.length; i++) {
MethodInfo getter = ReflectUtils.getMethodInfo(getters[i]);
e = EmitUtils.begin_method(ce, getter, Constants.ACC_PUBLIC);
e.load_this();
e.getfield(FIELD_NAME);
e.invoke(getter);
e.return_value();
e.end_method();
}
for (int i = 0; i < setters.length; i++) {
MethodInfo setter = ReflectUtils.getMethodInfo(setters[i]);
e = EmitUtils.begin_method(ce, setter, Constants.ACC_PUBLIC);
e.throw_exception(ILLEGAL_STATE_EXCEPTION, "Bean is immutable");
e.end_method();
}
ce.end_class();
}
示例8: generateClass
import org.springframework.asm.Type; //导入方法依赖的package包/类
public void generateClass(ClassVisitor v) {
Type sourceType = Type.getType(source);
Type targetType = Type.getType(target);
ClassEmitter ce = new ClassEmitter(v);
ce.begin_class(Constants.V1_6,
Constants.ACC_PUBLIC | Constants.ACC_SUPER,
getClassName(),
BEAN_COPIER,
null,
Constants.SOURCE_FILE);
EmitUtils.null_constructor(ce);
CodeEmitter e = ce.begin_method(Constants.ACC_PUBLIC, COPY, null);
PropertyDescriptor[] getters = ReflectUtils.getBeanGetters(source);
PropertyDescriptor[] setters = ReflectUtils.getBeanSetters(target);
Map names = new HashMap();
for (int i = 0; i < getters.length; i++) {
names.put(getters[i].getName(), getters[i]);
}
Local targetLocal = e.make_local();
Local sourceLocal = e.make_local();
if (useConverter) {
e.load_arg(1);
e.checkcast(targetType);
e.store_local(targetLocal);
e.load_arg(0);
e.checkcast(sourceType);
e.store_local(sourceLocal);
} else {
e.load_arg(1);
e.checkcast(targetType);
e.load_arg(0);
e.checkcast(sourceType);
}
for (int i = 0; i < setters.length; i++) {
PropertyDescriptor setter = setters[i];
PropertyDescriptor getter = (PropertyDescriptor)names.get(setter.getName());
if (getter != null) {
MethodInfo read = ReflectUtils.getMethodInfo(getter.getReadMethod());
MethodInfo write = ReflectUtils.getMethodInfo(setter.getWriteMethod());
if (useConverter) {
Type setterType = write.getSignature().getArgumentTypes()[0];
e.load_local(targetLocal);
e.load_arg(2);
e.load_local(sourceLocal);
e.invoke(read);
e.box(read.getSignature().getReturnType());
EmitUtils.load_class(e, setterType);
e.push(write.getSignature().getName());
e.invoke_interface(CONVERTER, CONVERT);
e.unbox_or_zero(setterType);
e.invoke(write);
} else if (compatible(getter, setter)) {
e.dup2();
e.invoke(read);
e.invoke(write);
}
}
}
e.return_value();
e.end_method();
ce.end_class();
}
示例9: FastClassEmitter
import org.springframework.asm.Type; //导入方法依赖的package包/类
public FastClassEmitter(ClassVisitor v, String className, Class type) {
super(v);
Type base = Type.getType(type);
begin_class(Constants.V1_6, Constants.ACC_PUBLIC | Constants.ACC_SUPER, className, FAST_CLASS, null, Constants.SOURCE_FILE);
// constructor
CodeEmitter e = begin_method(Constants.ACC_PUBLIC, CSTRUCT_CLASS, null);
e.load_this();
e.load_args();
e.super_invoke_constructor(CSTRUCT_CLASS);
e.return_value();
e.end_method();
VisibilityPredicate vp = new VisibilityPredicate(type, false);
List methods = ReflectUtils.addAllMethods(type, new ArrayList());
CollectionUtils.filter(methods, vp);
CollectionUtils.filter(methods, new DuplicatesPredicate());
List constructors = new ArrayList(Arrays.asList(type.getDeclaredConstructors()));
CollectionUtils.filter(constructors, vp);
// getIndex(String)
emitIndexBySignature(methods);
// getIndex(String, Class[])
emitIndexByClassArray(methods);
// getIndex(Class[])
e = begin_method(Constants.ACC_PUBLIC, CONSTRUCTOR_GET_INDEX, null);
e.load_args();
List info = CollectionUtils.transform(constructors, MethodInfoTransformer.getInstance());
EmitUtils.constructor_switch(e, info, new GetIndexCallback(e, info));
e.end_method();
// invoke(int, Object, Object[])
e = begin_method(Constants.ACC_PUBLIC, INVOKE, INVOCATION_TARGET_EXCEPTION_ARRAY);
e.load_arg(1);
e.checkcast(base);
e.load_arg(0);
invokeSwitchHelper(e, methods, 2, base);
e.end_method();
// newInstance(int, Object[])
e = begin_method(Constants.ACC_PUBLIC, NEW_INSTANCE, INVOCATION_TARGET_EXCEPTION_ARRAY);
e.new_instance(base);
e.dup();
e.load_arg(0);
invokeSwitchHelper(e, constructors, 1, base);
e.end_method();
// getMaxIndex()
e = begin_method(Constants.ACC_PUBLIC, GET_MAX_INDEX, null);
e.push(methods.size() - 1);
e.return_value();
e.end_method();
end_class();
}