use of com.github.javaparser.ast.expr.ThisExpr in project drools by kiegroup.
the class FEELPropertyAccessibleImplementation method toGetPropertySwitchEntry.
private SwitchEntry toGetPropertySwitchEntry(DMNDeclaredField fieldDefinition) {
ReturnStmt returnStmt = new ReturnStmt();
MethodCallExpr mc = StaticJavaParser.parseExpression(EvalHelper.PropertyValueResult.class.getCanonicalName() + ".ofValue()");
String accessorName = fieldDefinition.overriddenGetterName().orElse(getAccessorName(fieldDefinition, "get"));
mc.addArgument(new MethodCallExpr(new ThisExpr(), accessorName));
returnStmt.setExpression(mc);
return new SwitchEntry(nodeList(new StringLiteralExpr(fieldDefinition.getOriginalMapKey())), SwitchEntry.Type.STATEMENT_GROUP, nodeList(returnStmt));
}
use of com.github.javaparser.ast.expr.ThisExpr in project drools by kiegroup.
the class FEELPropertyAccessibleImplementation method toSetPropertySwitchEntry.
private SwitchEntry toSetPropertySwitchEntry(DMNDeclaredField fieldDefinition) {
String accessorName = fieldDefinition.overriddenSetterName().orElse(getAccessorName(fieldDefinition, "set"));
MethodCallExpr setMethod = new MethodCallExpr(new ThisExpr(), accessorName);
setMethod.addArgument(new CastExpr(StaticJavaParser.parseType(fieldDefinition.getObjectType()), new NameExpr("value")));
ExpressionStmt setStatement = new ExpressionStmt();
setStatement.setExpression(setMethod);
NodeList<Expression> labels = nodeList(new StringLiteralExpr(fieldDefinition.getOriginalMapKey()));
NodeList<Statement> statements = nodeList(setStatement, new ReturnStmt());
return new SwitchEntry(labels, SwitchEntry.Type.STATEMENT_GROUP, statements);
}
use of com.github.javaparser.ast.expr.ThisExpr in project checker-framework by typetools.
the class JointJavacJavaParserVisitor method visitMemberSelect.
@Override
public Void visitMemberSelect(MemberSelectTree javacTree, Node javaParserNode) {
if (javaParserNode instanceof FieldAccessExpr) {
FieldAccessExpr node = (FieldAccessExpr) javaParserNode;
processMemberSelect(javacTree, node);
javacTree.getExpression().accept(this, node.getScope());
} else if (javaParserNode instanceof Name) {
Name node = (Name) javaParserNode;
processMemberSelect(javacTree, node);
assert node.getQualifier().isPresent();
javacTree.getExpression().accept(this, node.getQualifier().get());
} else if (javaParserNode instanceof ClassOrInterfaceType) {
ClassOrInterfaceType node = (ClassOrInterfaceType) javaParserNode;
processMemberSelect(javacTree, node);
assert node.getScope().isPresent();
javacTree.getExpression().accept(this, node.getScope().get());
} else if (javaParserNode instanceof ClassExpr) {
ClassExpr node = (ClassExpr) javaParserNode;
processMemberSelect(javacTree, node);
javacTree.getExpression().accept(this, node.getType());
} else if (javaParserNode instanceof ThisExpr) {
ThisExpr node = (ThisExpr) javaParserNode;
processMemberSelect(javacTree, node);
assert node.getTypeName().isPresent();
javacTree.getExpression().accept(this, node.getTypeName().get());
} else if (javaParserNode instanceof SuperExpr) {
SuperExpr node = (SuperExpr) javaParserNode;
processMemberSelect(javacTree, node);
assert node.getTypeName().isPresent();
javacTree.getExpression().accept(this, node.getTypeName().get());
} else {
throwUnexpectedNodeType(javacTree, javaParserNode);
}
return null;
}
use of com.github.javaparser.ast.expr.ThisExpr in project checker-framework by typetools.
the class DoubleJavaParserVisitor method visit.
@Override
public void visit(final ThisExpr node1, final Node other) {
ThisExpr node2 = (ThisExpr) other;
defaultAction(node1, node2);
node1.getTypeName().ifPresent(l -> l.accept(this, node2.getTypeName().get()));
}
Aggregations