• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NewExpr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中javassist.expr.NewExpr的典型用法代码示例。如果您正苦于以下问题:Java NewExpr类的具体用法?Java NewExpr怎么用?Java NewExpr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NewExpr类属于javassist.expr包,在下文中一共展示了NewExpr类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: edit

import javassist.expr.NewExpr; //导入依赖的package包/类
/**
 * Is called when an instance creation occurs. Replaces references to 
 * classes to be removed by the value expression in the annotation 
 * or by <b>null</b>.
 *
 * @param expression the instance creation expression to be processed
 * @throws CannotCompileException in case of errors in the generated 
 *    byte code
 */
@Override
public void edit(NewExpr expression) throws CannotCompileException {
    try {
        CtConstructor cons  = expression.getConstructor();
        CtClass declaring = cons.getDeclaringClass();
        if (removals.containsKey(cons.getLongName()) 
            || classesForRemoval.contains(declaring)) {
            Variability annotation = Annotations.getAnnotationRec(
                declaring, Variability.class, 
                config.checkRecursively());
            String expr;
            if (null != annotation && annotation.value().length() > 0) {
                expr = "$_ = new " + annotation.value() + "($$);";
            } else {
                expr = "$_ = null;";
            }
            expression.replace(expr);
        }
    } catch (NotFoundException ex) {
        throw new CannotCompileException(ex);
    }
}
 
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:32,代码来源:CodeProcessor.java


示例2: edit

import javassist.expr.NewExpr; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public void edit(NewExpr ex) throws CannotCompileException {
    try {
        addTypeIf(innerClassPrefix, 
            ex.getConstructor().getDeclaringClass(), 
            targetClassName, inner);
    } catch (NotFoundException e) {
        throw new CannotCompileException(e);
    }
}
 
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:13,代码来源:CodeProcessor.java


示例3: edit

import javassist.expr.NewExpr; //导入依赖的package包/类
/**
 * Instruments an object creation.
 * 
 * @param ne the expression to be annotated
 * @throws CannotCompileException in case that the new code does not 
 *   compile
 */
public void edit(NewExpr ne) throws CannotCompileException {
    try {
        expression = ne;
        editor.editNewExpression(ne.getClassName());
    } catch (InstrumenterException e) {
        throw new CannotCompileException(e);
    }
}
 
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:16,代码来源:AllDelegatingEditor.java


示例4: edit

import javassist.expr.NewExpr; //导入依赖的package包/类
@Override
public void edit(NewExpr newExpression) throws CannotCompileException {
    logger.warn(" >>> NewExpr: {}, line {}, {}", new Object[]{newExpression.getEnclosingClass().getName(), 
            newExpression.getLineNumber(), newExpression.getSignature()});
    try {
        CtConstructor constructor = newExpression.getConstructor();
        CtClass ctClass = constructor.getDeclaringClass();
        MethodDescriptor methodDescriptor = new MethodDescriptor(newExpression);

        if (classTransformer.isAlreadyInstrumented(methodDescriptor)) {
            return;
        }
        classTransformer.addInstrumentation(methodDescriptor);

        if (ctClass.isFrozen()) {
            logger.warn("'{}' is 'frozen'", ctClass.getName());
            return;
        }

        instrument(constructor, ctClass, methodDescriptor);

        Transformation transformation = classTransformer.getTransformation(ctClass.getName());
        if (transformation != null) {
            java.lang.instrument.Instrumentation javainstrumentation = classTransformer.getInstrumentation();
            ProfilingClassFileTransformer localTransformer = new ProfilingClassFileTransformer(javainstrumentation);
            javainstrumentation.addTransformer(localTransformer, true);
            Class<?> cls1 = Class.forName(ctClass.getName());
            ClassDefinition classDefinition = new ClassDefinition(cls1, ctClass.toBytecode());
            javainstrumentation.redefineClasses(classDefinition);

            javainstrumentation.removeTransformer(localTransformer);

        }
    } catch (Exception e1) {
        logger.error(e1.getMessage(), e1);
    }

}
 
开发者ID:evandor,项目名称:unitprofiler,代码行数:39,代码来源:ProfilingExprEditor.java


示例5: getConstructorEntry

import javassist.expr.NewExpr; //导入依赖的package包/类
public static ConstructorEntry getConstructorEntry(NewExpr call) {
	return new ConstructorEntry(
		new ClassEntry(Descriptor.toJvmName(call.getClassName())),
		new Signature(call.getSignature())
	);
}
 
开发者ID:cccssw,项目名称:enigma-vk,代码行数:7,代码来源:EntryFactory.java


示例6: getConstructorEntry

import javassist.expr.NewExpr; //导入依赖的package包/类
public static ConstructorEntry getConstructorEntry(NewExpr call) {
    return new ConstructorEntry(new ClassEntry(Descriptor.toJvmName(call.getClassName())), new Signature(call.getSignature()));
}
 
开发者ID:OpenModLoader,项目名称:Enigma,代码行数:4,代码来源:EntryFactory.java


示例7: getConstructorEntry

import javassist.expr.NewExpr; //导入依赖的package包/类
public static ConstructorEntry getConstructorEntry(NewExpr call)
{
	return new ConstructorEntry(new ClassEntry(Descriptor.toJvmName(call
		.getClassName())), new Signature(call.getSignature()));
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-Enigma,代码行数:6,代码来源:EntryFactory.java


示例8: MethodDescriptor

import javassist.expr.NewExpr; //导入依赖的package包/类
public MethodDescriptor(NewExpr newExpr) throws NotFoundException {
    this(newExpr.getClassName(), newExpr.getConstructor().getName(), newExpr.getLineNumber());   
}
 
开发者ID:evandor,项目名称:unitprofiler,代码行数:4,代码来源:MethodDescriptor.java


示例9: edit

import javassist.expr.NewExpr; //导入依赖的package包/类
public void edit(NewExpr e) throws CannotCompileException { } 
开发者ID:petablox-project,项目名称:petablox,代码行数:2,代码来源:BasicInstrumentor.java



注:本文中的javassist.expr.NewExpr类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EmptyResponseProto类代码示例发布时间:2022-05-22
下一篇:
Java CopyMapper类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap