Search in sources :

Example 1 with ConfigurationOption

use of com.github.javaparser.printer.configuration.ConfigurationOption in project drools by kiegroup.

the class ConstraintPrintVisitor method printArguments.

public void printArguments(final NodeList<Expression> args, final Void arg) {
    printer.print("(");
    if (!isNullOrEmpty(args)) {
        boolean columnAlignParameters = (args.size() > 1) && configuration.get(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_PARAMETERS)).map(ConfigurationOption::asBoolean).orElse(false);
        if (columnAlignParameters) {
            printer.indentWithAlignTo(printer.getCursor().column);
        }
        for (final Iterator<Expression> i = args.iterator(); i.hasNext(); ) {
            final Expression e = i.next();
            e.accept(this, arg);
            if (i.hasNext()) {
                printer.print(",");
                if (columnAlignParameters) {
                    printer.println();
                } else {
                    printer.print(" ");
                }
            }
        }
        if (columnAlignParameters) {
            printer.unindent();
        }
    }
    printer.print(")");
}
Also used : DefaultConfigurationOption(com.github.javaparser.printer.configuration.DefaultConfigurationOption) Expression(com.github.javaparser.ast.expr.Expression) ListCreationLiteralExpression(org.drools.mvel.parser.ast.expr.ListCreationLiteralExpression) DrlxExpression(org.drools.mvel.parser.ast.expr.DrlxExpression) MapCreationLiteralExpression(org.drools.mvel.parser.ast.expr.MapCreationLiteralExpression) ConfigurationOption(com.github.javaparser.printer.configuration.ConfigurationOption) DefaultConfigurationOption(com.github.javaparser.printer.configuration.DefaultConfigurationOption)

Aggregations

Expression (com.github.javaparser.ast.expr.Expression)1 ConfigurationOption (com.github.javaparser.printer.configuration.ConfigurationOption)1 DefaultConfigurationOption (com.github.javaparser.printer.configuration.DefaultConfigurationOption)1 DrlxExpression (org.drools.mvel.parser.ast.expr.DrlxExpression)1 ListCreationLiteralExpression (org.drools.mvel.parser.ast.expr.ListCreationLiteralExpression)1 MapCreationLiteralExpression (org.drools.mvel.parser.ast.expr.MapCreationLiteralExpression)1