/** * Generates a compilable class that reports a (compile-time) error at runtime */ public static CompiledFEELExpression compiledError(String expression, String msg) { return new CompilerBytecodeLoader() .makeFromJPExpression( expression, compiledErrorExpression(msg), Collections.emptySet()); }
public <T> T internal_makefromJP(Class<T> clazz, String templateResourcePath, String cuPackage, String cuClass, String feelExpression, Expression theExpression, Set<FieldDeclaration> fieldDeclarations) { CompilationUnit cu = getCompilationUnit(clazz, templateResourcePath, cuPackage, cuClass, feelExpression, theExpression, fieldDeclarations ); return compileUnit(cuPackage, cuClass, cu); }
public CompiledFEELExpression makeFromJPExpression(String feelExpression, Expression theExpression, Set<FieldDeclaration> fieldDeclarations) { return internal_makefromJP(CompiledFEELExpression.class, "/TemplateCompiledFEELExpression.java", generateRandomPackage(), "TemplateCompiledFEELExpression", feelExpression, theExpression, fieldDeclarations); }
private CompiledFEELUnaryTests parse(String input, Map<String, Type> inputTypes, FEELEventListenersManager mgr, CompiledFEELSupport.SyntaxErrorListener listener) { FEEL_1_1Parser parser = FEELParser.parse(mgr, input, inputTypes, Collections.emptyMap(), Collections.emptyList(), Collections.emptyList()); ParseTree tree = parser.unaryTestsRoot(); DirectCompilerResult directResult; if (listener.isError()) { directResult = CompiledFEELSupport.compiledErrorUnaryTest(listener.event().getMessage()); } else { ASTBuilderVisitor v = new ASTBuilderVisitor(inputTypes); BaseNode node = v.visit(tree); BaseNode transformed = node.accept(new ASTUnaryTestTransform()).node(); directResult = transformed.accept(new ASTCompilerVisitor()); } Expression expr = directResult.getExpression(); CompiledFEELUnaryTests cu = new CompilerBytecodeLoader().makeFromJPUnaryTestsExpression(input, expr, directResult.getFieldDeclarations()); return cu; }
public CompiledFEELExpression makeFromJPExpression(Expression theExpression) { return makeFromJPExpression(null, theExpression, Collections.emptySet()); }
public String getSourceForUnaryTest(String packageName, String className, String feelExpression, Expression theExpression, Set<FieldDeclaration> fieldDeclarations) { CompilationUnit cu = getCompilationUnit(CompiledFEELUnaryTests.class, "/TemplateCompiledFEELUnaryTests.java", packageName, className, feelExpression, theExpression, fieldDeclarations ); ClassOrInterfaceDeclaration classSource = cu.getClassByName( className ).get(); classSource.setStatic( true ); return classSource.toString(); }
public UnaryTestCompiledExecutableExpression getCompiled() { CompiledFEELUnaryTests compiledFEELExpression = compiler.compileUnit( packageName, TEMPLATE_CLASS, getSourceCode()); return new UnaryTestCompiledExecutableExpression(compiledFEELExpression); }
public CompiledFEELUnaryTests makeFromJPUnaryTestsExpression(String packageName, String className, String feelExpression, Expression theExpression, Set<FieldDeclaration> fieldDeclarations) { return internal_makefromJP(CompiledFEELUnaryTests.class, "/TemplateCompiledFEELUnaryTests.java", packageName, className, feelExpression, theExpression, fieldDeclarations); }
public String getSourceForUnaryTest(String packageName, String className, String feelExpression, DirectCompilerResult directResult) { return getSourceForUnaryTest(packageName, className, feelExpression, directResult.getExpression(), directResult.getFieldDeclarations()); }
.filter(fd -> !isUnaryTest(fd)) .sorted(new SortFieldDeclarationStrategy()).forEach(classDecl::addMember); fieldDeclarations.stream()
public CompilationUnit getSourceCode() { DirectCompilerResult compilerResult = getCompilerResult(); return compiler.getCompilationUnit( CompiledFEELUnaryTests.class, TEMPLATE_RESOURCE, packageName, TEMPLATE_CLASS, expression, compilerResult.getExpression(), compilerResult.getFieldDeclarations()); }
public CompiledExecutableExpression getCompiled() { CompiledFEELExpression compiledFEELExpression = compiler.compileUnit( packageName, TEMPLATE_CLASS, getSourceCode()); return new CompiledExecutableExpression(compiledFEELExpression); }
private CompiledFEELExpression parse(String input, Map<String, Type> inputTypes) { FEEL_1_1Parser parser = FEELParser.parse(null, input, inputTypes, Collections.emptyMap(), Collections.emptyList(), Collections.emptyList()); ParseTree tree = parser.compilation_unit(); ASTBuilderVisitor v = new ASTBuilderVisitor(inputTypes); BaseNode node = v.visit(tree); DirectCompilerResult directResult = node.accept(new ASTCompilerVisitor()); Expression expr = directResult.getExpression(); CompiledFEELExpression cu = new CompilerBytecodeLoader().makeFromJPExpression(input, expr, directResult.getFieldDeclarations()); return cu; }
public CompiledFEELUnaryTests makeFromJPUnaryTestsExpression(String feelExpression, Expression theExpression, Set<FieldDeclaration> fieldDeclarations) { return internal_makefromJP(CompiledFEELUnaryTests.class, "/TemplateCompiledFEELUnaryTests.java", generateRandomPackage(), "TemplateCompiledFEELUnaryTests", feelExpression, theExpression, fieldDeclarations); }
public CompilationUnit getSourceCode() { DirectCompilerResult compilerResult = getCompilerResult(); return compiler.getCompilationUnit( CompiledFEELExpression.class, TEMPLATE_RESOURCE, packageName, TEMPLATE_CLASS, expression, compilerResult.getExpression(), compilerResult.getFieldDeclarations()); }