public void visitPredicateDescr(final PredicateDescr descr) { this.template = new String(); this.template = "<predicate>" + replaceIllegalChars( (String) descr.getContent() ) + "</predicate>" + XmlDumper.eol; }
public void build(final RuleBuildContext context, final BoundIdentifiers usedIdentifiers, final Declaration[] previousDeclarations, final Declaration[] localDeclarations, final PredicateConstraint predicateConstraint, final PredicateDescr predicateDescr, final AnalysisResult analysis) { final String className = "predicate" + context.getNextId(); predicateDescr.setClassMethodName( className ); final Map map = createVariableContext( className, (String) predicateDescr.getContent(), context, previousDeclarations, localDeclarations, usedIdentifiers.getGlobals() ); generateTemplates("predicateMethod", "predicateInvoker", context, className, map, predicateConstraint, predicateDescr); }
predicateDescr, null, "Predicate '" + predicateDescr.getContent() + "' must be a Boolean expression\n" + predicateDescr.positionAsString() ) ); unit = dialect.getMVELCompilationUnit( (String) predicateDescr.getContent(), analysis, previousDeclarations, predicateDescr, e, "Unable to build expression for 'inline-eval' : " + e.getMessage() + "'" + predicateDescr.getContent() + "'\n" + e.getMessage() ) );
public static AnalysisResult buildAnalysis(RuleBuildContext context, Pattern pattern, PredicateDescr predicateDescr, Map<String, OperatorDescr> aliases ) { Map<String, Class< ? >> declarations = getDeclarationsMap( predicateDescr, context, true ); Map<String, Class< ? >> globals = context.getPackageBuilder().getGlobals(); Map<String, EvaluatorWrapper> operators = aliases == null ? new HashMap<String, EvaluatorWrapper>() : buildOperators(context, pattern, predicateDescr, aliases); Class< ? > thisClass = null; if ( pattern.getObjectType() instanceof ClassObjectType) { thisClass = ((ClassObjectType) pattern.getObjectType()).getClassType(); } return context.getDialect().analyzeExpression( context, predicateDescr, predicateDescr.getContent(), new BoundIdentifiers( declarations, globals, operators, thisClass ) ); }
public void build(final RuleBuildContext context, final BoundIdentifiers usedIdentifiers, final Declaration[] previousDeclarations, final Declaration[] localDeclarations, final PredicateConstraint predicateConstraint, final PredicateDescr predicateDescr, final AnalysisResult analysis) { final String className = "predicate" + context.getNextId(); predicateDescr.setClassMethodName( className ); final Map vars = createVariableContext( className, (String) predicateDescr.getContent(), context, previousDeclarations, localDeclarations, usedIdentifiers.getGlobals() ); generateMethodTemplate("predicateMethod", context, vars); byte[] bytecode = createPredicateBytecode(context, vars); registerInvokerBytecode(context, vars, bytecode, predicateConstraint); }
predicateDescr, null, "Predicate '" + predicateDescr.getContent() + "' must be a Boolean expression\n" + predicateDescr.positionAsString() ) ); MVELCompilationUnit unit = dialect.getMVELCompilationUnit((String) predicateDescr.getContent(), analysis, previousDeclarations, predicateDescr, e, "Unable to build expression for 'inline-eval' : " + e.getMessage() + "'" + predicateDescr.getContent() + "'\n" + e.getMessage() ) ); } finally { context.setTypesafe( typesafe );