public static Object evalFile(File file, String encoding, Object ctx, Map<String, Object> vars) throws IOException { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return _evalFile(file, encoding, ctx, factory); } finally { factory.externalize(); } }
public static void executeExpression(Iterable<CompiledExpression> compiledExpression, Object ctx, Map vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); executeExpression(compiledExpression, ctx, factory); factory.externalize(); }
public static void executeExpression(Iterable<CompiledExpression> compiledExpression, Map vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); executeExpression(compiledExpression, null, factory); factory.externalize(); }
public static void executeExpression(Iterable<CompiledExpression> compiledExpression, Object ctx, Map vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); executeExpression(compiledExpression, ctx, factory); factory.externalize(); }
public static Object evalFile(File file, String encoding, Object ctx, Map<String, Object> vars) throws IOException { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return _evalFile(file, encoding, ctx, factory); } finally { factory.externalize(); } }
public static void executeExpression(Iterable<CompiledExpression> compiledExpression, Map vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); executeExpression(compiledExpression, null, factory); factory.externalize(); }
/** * Evaluate a script from a file with injected variables and return the resultant value. * * @param file The file to process * @param vars Variables to be injected * @return The resultant value * @throws IOException Exception thrown if there is an IO problem accessing the file. */ public static Object evalFile(File file, Map<String, Object> vars) throws IOException { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return _evalFile(file, null, factory); } finally { factory.externalize(); } }
/** * Evaluate a script from a file with injected variables and a context object, then return the resultant value. * * @param file The file to process * @param ctx The context to evaluate the script against. * @param vars Variables to be injected * @return The resultant value * @throws IOException Exception thrown if there is an IO problem accessing the file. */ public static Object evalFile(File file, Object ctx, Map<String, Object> vars) throws IOException { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return _evalFile(file, ctx, factory); } finally { factory.externalize(); } }
/** * Executes a compiled expression. * * @param compiledExpression - * @param vars - * @return - * @see #compileExpression(String) */ @SuppressWarnings({"unchecked"}) public static Object executeExpression(final Object compiledExpression, final Map vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return ((ExecutableStatement) compiledExpression).getValue(null, factory); } finally { factory.externalize(); } }
/** * Evaluate a script from a file with injected variables and return the resultant value. * * @param file The file to process * @param vars Variables to be injected * @return The resultant value * @throws IOException Exception thrown if there is an IO problem accessing the file. */ public static Object evalFile(File file, Map<String, Object> vars) throws IOException { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return _evalFile(file, null, factory); } finally { factory.externalize(); } }
/** * Executes a compiled expression. * * @param compiledExpression - * @param ctx - * @param vars - * @return - * @see #compileExpression(String) */ @SuppressWarnings({"unchecked"}) public static Object executeExpression(final Object compiledExpression, final Object ctx, final Map vars) { CachingMapVariableResolverFactory factory = vars != null ? new CachingMapVariableResolverFactory(vars) : null; try { return ((ExecutableStatement) compiledExpression).getValue(ctx, factory); } finally { if (factory != null) factory.externalize(); } }
/** * Executes a compiled expression. * * @param compiledExpression - * @param ctx - * @param vars - * @return - * @see #compileExpression(String) */ @SuppressWarnings({"unchecked"}) public static Object executeExpression(final Object compiledExpression, final Object ctx, final Map vars) { CachingMapVariableResolverFactory factory = vars != null ? new CachingMapVariableResolverFactory(vars) : null; try { return ((ExecutableStatement) compiledExpression).getValue(ctx, factory); } finally { if (factory != null) factory.externalize(); } }
/** * Evaluate a script from a file with injected variables and a context object, then return the resultant value. * * @param file The file to process * @param ctx The context to evaluate the script against. * @param vars Variables to be injected * @return The resultant value * @throws IOException Exception thrown if there is an IO problem accessing the file. */ public static Object evalFile(File file, Object ctx, Map<String, Object> vars) throws IOException { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return _evalFile(file, ctx, factory); } finally { factory.externalize(); } }
/** * Executes a compiled expression. * * @param compiledExpression - * @param vars - * @return - * @see #compileExpression(String) */ @SuppressWarnings({"unchecked"}) public static Object executeExpression(final Object compiledExpression, final Map vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return ((ExecutableStatement) compiledExpression).getValue(null, factory); } finally { factory.externalize(); } }
/** * Evaluates an expression against externally injected variables. This is a wrapper convenience method which * wraps the provided Map of vars in a {@link MapVariableResolverFactory} * * @param expression A string containing the expression to be evaluated. * @param vars A map of vars to be injected * @return The resultant value * @see #eval(String, org.mvel2.integration.VariableResolverFactory) */ public static Object eval(String expression, Map<String, Object> vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return new MVELInterpretedRuntime(expression, null, factory).parse(); } finally { factory.externalize(); } }
/** * Evaluates an expression against a context object and externally injected variables. This is a wrapper * convenience method which wraps the provided Map of vars in a {@link MapVariableResolverFactory} * * @param expression A string containing the expression to be evaluated. * @param ctx The context object to evaluate against. * @param vars A map of vars to be injected * @return The resultant value * @see #eval(String, VariableResolverFactory) */ public static Object eval(String expression, Object ctx, Map<String, Object> vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return new MVELInterpretedRuntime(expression, ctx, factory).parse(); } finally { factory.externalize(); } }
/** * Evaluates an expression against externally injected variables. This is a wrapper convenience method which * wraps the provided Map of vars in a {@link MapVariableResolverFactory} * * @param expression A string containing the expression to be evaluated. * @param vars A map of vars to be injected * @return The resultant value * @see #eval(String, org.mvel2.integration.VariableResolverFactory) */ public static Object eval(String expression, Map<String, Object> vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return new MVELInterpretedRuntime(expression, null, factory).parse(); } finally { factory.externalize(); } }
/** * Evaluates an expression against a context object and externally injected variables. This is a wrapper * convenience method which wraps the provided Map of vars in a {@link MapVariableResolverFactory} * * @param expression A string containing the expression to be evaluated. * @param ctx The context object to evaluate against. * @param vars A map of vars to be injected * @return The resultant value * @see #eval(String, VariableResolverFactory) */ public static Object eval(String expression, Object ctx, Map<String, Object> vars) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return new MVELInterpretedRuntime(expression, ctx, factory).parse(); } finally { factory.externalize(); } }
/** * Evaluates an expression against externally injected variables. The resultant value is coerced to the specified * type if necessary. This is a wrapper convenience method which wraps the provided Map of vars in a{@link MapVariableResolverFactory} * * @param expression A string containing the expression to be evaluated. * @param vars A map of vars to be injected * @param toType The target type the resultant value will be converted to, if necessary. * @return The resultant value * @see #eval(String, org.mvel2.integration.VariableResolverFactory) */ public static <T> T eval(String expression, Map<String, Object> vars, Class<T> toType) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return convert(new MVELInterpretedRuntime(expression, null, factory).parse(), toType); } finally { factory.externalize(); } }
/** * Evaluates an expression against externally injected variables. The resultant value is coerced to the specified * type if necessary. This is a wrapper convenience method which wraps the provided Map of vars in a{@link MapVariableResolverFactory} * * @param expression A string containing the expression to be evaluated. * @param vars A map of vars to be injected * @param toType The target type the resultant value will be converted to, if necessary. * @return The resultant value * @see #eval(String, org.mvel2.integration.VariableResolverFactory) */ public static <T> T eval(String expression, Map<String, Object> vars, Class<T> toType) { CachingMapVariableResolverFactory factory = new CachingMapVariableResolverFactory(vars); try { return convert(new MVELInterpretedRuntime(expression, null, factory).parse(), toType); } finally { factory.externalize(); } }