Java Code Examples for com.googlecode.aviator.AviatorEvaluator#execute()

The following examples show how to use com.googlecode.aviator.AviatorEvaluator#execute() . 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: AviaterELFilter.java    From binlake with Apache License 2.0 5 votes vote down vote up
public boolean filter(WaveEntry.Entry entry) throws BinlogException {
    if (StringUtils.isEmpty(expression)) {
        return true;
    }

    Map<String, Object> env = new HashMap<String, Object>();
    env.put(ROOT_KEY, entry);
    return (Boolean) AviatorEvaluator.execute(expression, env);
}
 
Example 2
Source File: UKTools.java    From youkefu with Apache License 2.0 5 votes vote down vote up
/***
 * 计算T+1
 * @param text
 * @param format
 * @return
 */
public static Object getDaysParam(String text){
	Map<String,Object>  context = new HashMap<String,Object>();
	context.put("T", processDays()) ;
	context.put("t", processDays()) ;
	context.put("M", processMonth()) ;
	context.put("m", processMonth()) ;
	context.put("Y", processYear()) ;
	context.put("y", processYear()) ;
	
   	return AviatorEvaluator.execute(text , context) ;
}
 
Example 3
Source File: AviaterELFilter.java    From canal-1.1.3 with Apache License 2.0 5 votes vote down vote up
public boolean filter(CanalEntry.Entry entry) throws CanalFilterException {
    if (StringUtils.isEmpty(expression)) {
        return true;
    }

    Map<String, Object> env = new HashMap<String, Object>();
    env.put(ROOT_KEY, entry);
    return (Boolean) AviatorEvaluator.execute(expression, env);
}
 
Example 4
Source File: AviaterELFilter.java    From canal with Apache License 2.0 5 votes vote down vote up
public boolean filter(CanalEntry.Entry entry) throws CanalFilterException {
    if (StringUtils.isEmpty(expression)) {
        return true;
    }

    Map<String, Object> env = new HashMap<String, Object>();
    env.put(ROOT_KEY, entry);
    return (Boolean) AviatorEvaluator.execute(expression, env);
}
 
Example 5
Source File: WarningRuleHelper.java    From seppb with MIT License 4 votes vote down vote up
@Override
public Object runAndReturn(String expression, T t) {
    return AviatorEvaluator.execute(expression, beanToMap(t));
}