public void addAllImports(Map<String, Object> imports) { if (imports == null) return; Object o; for (Map.Entry<String, Object> entry : imports.entrySet()) { if ((o = entry.getValue()) instanceof Method) { this.imports.put(entry.getKey(), new MethodStub((Method) o)); } else { this.imports.put(entry.getKey(), o); } } }
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
Method m = pCtx.getStaticImport(name).getMethod();
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
Method m = pCtx.getStaticImport(name).getMethod();
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
public void addAllImports(Map<String, Object> imports) { if (imports == null) return; Object o; for (Map.Entry<String, Object> entry : imports.entrySet()) { if ((o = entry.getValue()) instanceof Method) { this.imports.put(entry.getKey(), new MethodStub((Method) o)); } else { this.imports.put(entry.getKey(), o); } } }
Method m = pCtx.getStaticImport(name).getMethod();
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
public VariableResolver createVariable(String name, Object value) { if (value instanceof Method) value = new MethodStub((Method) value); StaticMethodImportResolver methodResolver = new StaticMethodImportResolver(name, (MethodStub) value); this.variableResolvers.put(name, methodResolver); return methodResolver; }
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
public void addAllImports(Map<String, Object> imports) { if (imports == null) return; if (this.imports == null) this.imports = new LinkedHashMap<String, Object>(); Object o; for (Map.Entry<String, Object> entry : imports.entrySet()) { if ((o = entry.getValue()) instanceof Method) { this.imports.put(entry.getKey(), new MethodStub((Method) o)); } else { this.imports.put(entry.getKey(), o); } } }
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
public VariableResolver createVariable(String name, Object value) { if (value instanceof Method) value = new MethodStub((Method) value); StaticMethodImportResolver methodResolver = new StaticMethodImportResolver(name, (MethodStub) value); this.variableResolvers.put(name, methodResolver); return methodResolver; }
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
public VariableResolver createVariable(String name, Object value) { if (value instanceof Method) value = new MethodStub((Method) value); StaticMethodImportResolver methodResolver = new StaticMethodImportResolver(name, (MethodStub) value); this.variableResolvers.put(name, methodResolver); return methodResolver; }
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
public void addImport(String name, Method method) { addImport(name, new MethodStub(method)); }
ctx = ((MethodStub) ptr).getClassReference(); name = ((MethodStub) ptr).getMethodName();
/** * Adds an import for a specified <tt>Method</tt> representing a static method import using an alias. For example: * <pre><code> * parserContext.addImport("time", MVEL.getStaticMethod(System.class, "currentTimeMillis", new Class[0])); * </code></pre> * ... doing this allows the <tt>System.currentTimeMillis()</tt> method to be executed in a script simply by writing * <tt>time()</tt>. * * @param name The alias to use * @param method The instance of <tt>Method</tt> which represents the static import. */ public void addImport(String name, Method method) { addImport(name, new MethodStub(method)); // addInput(name, MethodStub.class); }