本文整理汇总了Java中javassist.expr.NewArray类的典型用法代码示例。如果您正苦于以下问题:Java NewArray类的具体用法?Java NewArray怎么用?Java NewArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NewArray类属于javassist.expr包,在下文中一共展示了NewArray类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: edit
import javassist.expr.NewArray; //导入依赖的package包/类
/**
* Is called when an array instance creation occurs. Replaces
* references to classes to be removed by the value expression in
* the annotation or by <b>null</b>.
*
* @param arrayCreation the array creation expression to be processed
* @throws CannotCompileException in case of errors in the generated
* byte code
*/
@Override
public void edit(NewArray arrayCreation) throws CannotCompileException {
try {
CtClass type = arrayCreation.getComponentType();
if (!classesForRemoval.contains(type)) {
Variability annotation = Annotations.getAnnotationRec(type,
Variability.class, config.checkRecursively());
if (null != annotation && annotation.value().length() > 0) {
StringBuilder buf = new StringBuilder("$_ = new ");
buf.append(annotation.value());
for (int i = 1;
i <= arrayCreation.getCreatedDimensions(); i++) {
buf.append("[");
buf.append(i);
buf.append("]");
}
String expression = buf.toString();
arrayCreation.replace(expression);
}
}
} catch (NotFoundException ex) {
throw new CannotCompileException(ex);
}
}
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:34,代码来源:CodeProcessor.java
示例2: edit
import javassist.expr.NewArray; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void edit(NewArray ar) throws CannotCompileException {
try {
addTypeIf(innerClassPrefix, ar.getComponentType(),
targetClassName, inner);
} catch (NotFoundException e) {
throw new CannotCompileException(e);
}
}
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:13,代码来源:CodeProcessor.java
示例3: edit
import javassist.expr.NewArray; //导入依赖的package包/类
/**
* Instruments the creation of an array.
*
* @param na the array creation
*
* @throws CannotCompileException in case that the new code does
* not compile
*/
@Override
public void edit(NewArray na) throws CannotCompileException {
try {
expression = na;
editor.editNewArray();
} catch (InstrumenterException e) {
throw new CannotCompileException(e);
}
}
开发者ID:SSEHUB,项目名称:spassMeter,代码行数:18,代码来源:AllDelegatingEditor.java
示例4: edit
import javassist.expr.NewArray; //导入依赖的package包/类
@Override
public void edit(NewArray newArray) throws CannotCompileException {
logger.warn(" >>> NewArray {} line {}", newArray.getFileName(), newArray.getLineNumber());
try {
logger.warn("NewArray componentType {}", newArray.getComponentType());
} catch (NotFoundException e) {
e.printStackTrace(); // To change body of catch statement use File | Settings | File Templates.
}
logger.warn("NewArray, created dim. {}, dim {}", newArray.getCreatedDimensions(), newArray.getDimension());
logger.warn("");
}
开发者ID:evandor,项目名称:unitprofiler,代码行数:13,代码来源:ProfilingExprEditor.java
示例5: edit
import javassist.expr.NewArray; //导入依赖的package包/类
public void edit(NewArray e) throws CannotCompileException { }
开发者ID:petablox-project,项目名称:petablox,代码行数:2,代码来源:BasicInstrumentor.java
注:本文中的javassist.expr.NewArray类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论