微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

org.mockito.cglib.core.Constants的实例源码

项目:securemock    文件ReflectUtils.java   
public static Signature getSignature(Member member) {
    if (member instanceof Method) {
        return new Signature(member.getName(),Type.getmethodDescriptor((Method)member));
    } else if (member instanceof Constructor) {
        Type[] types = TypeUtils.getTypes(((Constructor)member).getParameterTypes());
        return new Signature(Constants.CONSTRUCTOR_NAME,Type.getmethodDescriptor(Type.VOID_TYPE,types));

    } else {
        throw new IllegalArgumentException("Cannot get signature of a field");
    }
}
项目:mockito-cglib    文件AddInitTransformer.java   
public AddInitTransformer(Method method) {
    info = ReflectUtils.getmethodInfo(method);

    Type[] types = info.getSignature().getArgumentTypes();
    if (types.length != 1 ||
    !types[0].equals(Constants.TYPE_OBJECT) ||
    !info.getSignature().getReturnType().equals(Type.VOID_TYPE)) {
        throw new IllegalArgumentException(method + " illegal signature");
    }
}
项目:mockito-cglib    文件AddInitTransformer.java   
public CodeEmitter begin_method(int access,Signature sig,Type[] exceptions) {
    final CodeEmitter emitter = super.begin_method(access,sig,exceptions);
    if (sig.getName().equals(Constants.CONSTRUCTOR_NAME)) {
        return new CodeEmitter(emitter) {
            public void visitInsn(int opcode) {
                if (opcode == Constants.RETURN) {
                    load_this();
                    invoke(info);
                }
                super.visitInsn(opcode);
            }
        };
    }
    return emitter;
}
项目:astor    文件AddInitTransformer.java   
public AddInitTransformer(Method method) {
    info = ReflectUtils.getmethodInfo(method);

    Type[] types = info.getSignature().getArgumentTypes();
    if (types.length != 1 ||
    !types[0].equals(Constants.TYPE_OBJECT) ||
    !info.getSignature().getReturnType().equals(Type.VOID_TYPE)) {
        throw new IllegalArgumentException(method + " illegal signature");
    }
}
项目:astor    文件AddInitTransformer.java   
public CodeEmitter begin_method(int access,exceptions);
    if (sig.getName().equals(Constants.CONSTRUCTOR_NAME)) {
        return new CodeEmitter(emitter) {
            public void visitInsn(int opcode) {
                if (opcode == Constants.RETURN) {
                    load_this();
                    invoke(info);
                }
                super.visitInsn(opcode);
            }
        };
    }
    return emitter;
}
项目:securemock    文件ReflectUtils.java   
public static Object newInstance(Class type) {
    return newInstance(type,Constants.EMPTY_CLASS_ARRAY,null);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。