use of com.github.javaparser.ast.expr.ArrayAccessExpr in project drools by kiegroup.
the class Consequence method rewriteChannels.
private void rewriteChannels(BlockStmt consequence) {
consequence.findAll(MethodCallExpr.class).stream().map(MethodCallExpr::getScope).filter(Optional::isPresent).map(Optional::get).filter(sc -> sc instanceof ArrayAccessExpr).map(aae -> (ArrayAccessExpr) aae).filter(aae -> aae.getName().asNameExpr().getNameAsString().equals("channels")).forEach(aae -> {
String channelName = aae.getIndex().asStringLiteralExpr().asString();
MethodCallExpr mce = new MethodCallExpr(new NameExpr("drools"), GET_CHANNEL_CALL);
mce.addArgument("\"" + channelName + "\"");
aae.replace(mce);
});
}
use of com.github.javaparser.ast.expr.ArrayAccessExpr in project checker-framework by typetools.
the class JointJavacJavaParserVisitor method visitArrayAccess.
@Override
public Void visitArrayAccess(ArrayAccessTree javacTree, Node javaParserNode) {
ArrayAccessExpr node = castNode(ArrayAccessExpr.class, javaParserNode, javacTree);
processArrayAccess(javacTree, node);
javacTree.getExpression().accept(this, node.getName());
javacTree.getIndex().accept(this, node.getIndex());
return null;
}
Aggregations