本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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("");
}
示例5: edit
import javassist.expr.NewArray; //导入依赖的package包/类
public void edit(NewArray e) throws CannotCompileException { }