com.googlecode.aviator.Expression Java Examples

The following examples show how to use com.googlecode.aviator.Expression. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AviatorExprUtils.java    From EasyReport with Apache License 2.0 5 votes vote down vote up
public static Object execute(final String expression, final Map<String, Object> context) {
    Object value = null;

    try {
        final Expression compiledExp = AviatorEvaluator.compile(expression, true);
        value = compiledExp.execute(context);
    } catch (final ExpressionRuntimeException ex) {
        logger.error(ex.getMessage());
    }

    return value;
}
 
Example #2
Source File: WarningRuleHelper.java    From seppb with MIT License 4 votes vote down vote up
@Override
public boolean execute(Expression expression, T t) {
    return (boolean) runAndReturn(expression, t);
}
 
Example #3
Source File: WarningRuleHelper.java    From seppb with MIT License 4 votes vote down vote up
@Override
public Object runAndReturn(Expression expression, T t) {
    return expression.execute(beanToMap(t));
}
 
Example #4
Source File: WarningRuleHelperTest.java    From seppb with MIT License 4 votes vote down vote up
@Test
public void execute1() {
    Expression compile = AviatorEvaluator.compile("(influence - foundMeans) / defectPeriod > 0 && (influence - foundMeans) / defectPeriod < 1");
    boolean execute = warningRuleHelper.execute(compile, defect);
    assertTrue(execute);
}
 
Example #5
Source File: WarningHelper.java    From seppb with MIT License votes vote down vote up
boolean execute(@NonNull Expression expression, @NonNull T t); 
Example #6
Source File: WarningHelper.java    From seppb with MIT License votes vote down vote up
Object runAndReturn(@NonNull Expression expression, @NonNull T t);