/// <summary> returns the value of the reference. Generally, this is only /// called for dynamic proxies, as the static ones should have /// been stored in the VMContext's localcontext store /// * /// </summary> /// <param name="context">Context to use for getting current value /// </param> /// <returns>Object value /// * /// /// </returns> public Object getObject(InternalContextAdapter context) { try { /* * we need to output based on our type */ Object retObject = null; if (type == ParserTreeConstants.JJTREFERENCE) { /* * two cases : scalar reference ($foo) or multi-level ($foo.bar....) */ if (numTreeChildren == 0) { /* * if I am a single-level reference, can I not get get it out of my context? */ retObject = context.Get(singleLevelRef); } else { /* * I need to let the AST produce it for me. */ retObject = nodeTree.execute(null, context); } } else if (type == ParserTreeConstants.JJTOBJECTARRAY) { retObject = nodeTree.Value(context); } else if (type == ParserTreeConstants.JJTINTEGERRANGE) { retObject = nodeTree.Value(context); } else if (type == ParserTreeConstants.JJTTRUE) { retObject = staticObject; } else if (type == ParserTreeConstants.JJTFALSE) { retObject = staticObject; } else if (type == ParserTreeConstants.JJTSTRINGLITERAL) { retObject = nodeTree.Value(context); } else if (type == ParserTreeConstants.JJTNUMBERLITERAL) { retObject = staticObject; } else if (type == ParserTreeConstants.JJTTEXT) { /* * this really shouldn't happen. text is just a thowaway arg for #foreach() */ try { StringWriter writer = new StringWriter(); nodeTree.render(context, writer); retObject = writer; } catch (Exception e) { rsvc.error("VMProxyArg.getObject() : error rendering reference : " + e); } } else if (type == GENERALSTATIC) { retObject = staticObject; } else { rsvc.error("Unsupported VM arg type : VM arg = " + callerReference + " type = " + type + "( VMProxyArg.getObject() )"); } return(retObject); } catch (MethodInvocationException mie) { /* * not ideal, but otherwise we propogate out to the * VMContext, and the Context interface's put/get * don't throw. So this is a the best compromise * I can think of */ rsvc.error("VMProxyArg.getObject() : method invocation error getting value : " + mie); return(null); } }