protected void addImports(ParserContext parserContext) throws SecurityException, NoSuchMethodException{ addPackageImports(parserContext); addAllStaticMethodsImport(parserContext, MvelUtils.class); addDateUtilsImports(parserContext); addAllStaticMethodsImport(parserContext, Iterators.class); }
/** * ファイルパスからReaderを取得します。 * @param filePath * @throws FileNotFoundException * @throws UnsupportedEncodingException */ public static Reader getReader(String filePath) throws FileNotFoundException, UnsupportedEncodingException{ return getReader(filePath, encoding); }
/** * ファイルをテキストとして読み込みます。 * @param filePath * @param encoding */ public static String readFileAsText(String filePath, String encoding){ return readFileAsText(filePath, encoding); }
/** * クラス内のstaticメソッドを一括でインポートします * @param parserContext * @param clazz */ protected void addAllStaticMethodsImport(ParserContext parserContext, Class<?> clazz){ List<Method> methods=getAllStaticMethods(clazz); for(Method method:methods){ addImport(parserContext, method); } }
protected CachedEvaluator getEvaluator() { if (evaluator == null) { evaluator = CachedMvelEvaluator.getInstance(); } return evaluator; }
@Override protected void addImports(ParserContext parserContext) throws SecurityException, NoSuchMethodException{ super.addImports(parserContext); addAllStaticMethodsImport(parserContext, HtmlUtils.class); } }
@Override public <T> T doEval(ParametersContext bindings, Class<T> clazz) { return MVEL.eval(getExpression(), bindings, clazz); }
@Override public boolean doEvalBoolean(ParametersContext bindings) { return MVEL.executeExpression(getCompliedExpression(), bindings, boolean.class); }
@Override protected EvalExecutor createEvalExecutor(String expression) throws Exception { MvelCompiledEvaluator evalExecutor=new MvelCompiledEvaluator(expression, parserContext); return evalExecutor; }
public static String writeZip(String filePath, String zipFilePath) throws URISyntaxException, IOException{ return writeZip(filePath, zipFilePath, null); }
/** * @param fileDirectory the fileDirectory to set */ public void setFileDirectory(File fileDirectory) { this.fileDirectory = fileDirectory; if (fileDirectory!=null){ MvelUtils.setBasePath(fileDirectory.getAbsolutePath()); } }
/** * ファイルパスからReaderを取得します。 * @param filePath * @param encoding * @throws FileNotFoundException * @throws UnsupportedEncodingException */ public static Reader getReader(String filePath, String encoding) throws FileNotFoundException, UnsupportedEncodingException{ return new InputStreamReader(getInputStream(filePath), encoding); }
private Serializable getCompliedExpression(){ if (compliedExpression==null){ synchronized (this){ if (parserContext==null){ compliedExpression=MVEL.compileExpression(getExpression()); } else{ compliedExpression=MVEL.compileExpression(getExpression(), parserContext); } } } return compliedExpression; } }
@Override public boolean doEvalBoolean(Object val) { return MVEL.eval(getExpression(), val, boolean.class); } }
@Override public Object doEval(Object val) { return MVEL.executeExpression(getCompliedExpression(), val); }
@Override public Object doEval(ParametersContext bindings){ return MVEL.eval(getExpression(), bindings); }
@Override public boolean doEvalBoolean(Object val) { return MVEL.executeExpression(getCompliedExpression(), val, boolean.class); }
@Override public Object doEval(Object val) { return MVEL.eval(getExpression(), val); }
@Override public Object doEval(ParametersContext bindings) { return MVEL.executeExpression(getCompliedExpression(), bindings); }
@Override public boolean doEvalBoolean(ParametersContext bindings) { return MVEL.eval(getExpression(), bindings, boolean.class); }