//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private org.camunda.bpm.engine.impl.javax.el.ELContext createElContext(final javax.script.ScriptContext scriptCtx) private ELContext createElContext(ScriptContext scriptCtx) { // Check if the ELContext is already stored on the ScriptContext object existingELCtx = scriptCtx.getAttribute("elcontext"); if (existingELCtx is ELContext) { return((ELContext)existingELCtx); } scriptCtx.setAttribute("context", scriptCtx, ScriptContext.ENGINE_SCOPE); // Built-in function are added to ScriptCtx scriptCtx.setAttribute("out:print", PrintMethod, ScriptContext.ENGINE_SCOPE); SecurityManager securityManager = System.SecurityManager; if (securityManager == null) { scriptCtx.setAttribute("lang:import", ImportMethod, ScriptContext.ENGINE_SCOPE); } ELContext elContext = new ELContextAnonymousInnerClass(this, scriptCtx); // Store the elcontext in the scriptContext to be able to reuse scriptCtx.setAttribute("elcontext", elContext, ScriptContext.ENGINE_SCOPE); return(elContext); }
/// <summary> /// Dump out abstract syntax tree for a given expression /// </summary> /// <param name="args"> array with one element, containing the expression string </param> public static void Main(string[] args) { if (args.Length != 1) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: Console.Error.WriteLine("usage: java " + typeof(Builder).FullName + " <expression string>"); Environment.Exit(1); } PrintWriter @out = new PrintWriter(System.out); Tree tree = null; try { tree = (new Builder(Feature.METHOD_INVOCATIONS)).build(args[0]); } catch (TreeBuilderException e) { Console.WriteLine(e.Message); Environment.Exit(0); } NodePrinter.dump(@out, tree.Root); if (!tree.FunctionNodes.GetEnumerator().hasNext() && !tree.IdentifierNodes.GetEnumerator().hasNext()) { ELContext context = new ELContextAnonymousInnerClass(); @out.print(">> "); try { @out.println(tree.Root.getValue(new Bindings(null, null), context, null)); } catch (ELException e) { @out.println(e.Message); } } @out.flush(); }