system/src/sc/lang/template/Template.java
public Object eval(Class expectedType, ExecutionContext ctx) {
      StringBuilder sb = null;
      boolean newObj = false;
      ctx.pushFrame(true, 1);
      try {
         if (outputMethod == null) {
            sb = new StringBuilder();
            ctx.defineVariable("out", sb);
            OutputCtx octx = new OutputCtx();
            ctx.defineVariable("ctx", octx);
         }

         if (createInstance && rootType != null) {
            ctx.pushCurrentObject(ModelUtil.createInstance(rootType, null, new ArrayList<Expression>(0), ctx));
            newObj = true;
         }

         if (outputRuntimeMethod != null) {
            sb = (StringBuilder) ModelUtil.invokeMethod(ctx.getCurrentObject(), outputRuntimeMethod, null, ctx);
         }
         else if (outputMethod != null) {
            if (outputMethod.getNumParameters() == 0)
               sb = (StringBuilder) outputMethod.invoke(ctx, null); // TODO: any cases where we need to pass params here?  I think this is just web.scxml
            else
               displayError("OutputMethod generated for template has parameters: " + outputMethod.name + " No method named 'output' for template eval");
         }
         else {
            if (templateDeclarations != null)
               ModelUtil.execTemplateDeclarations(sb, ctx, templateDeclarations);
         }
      }
      finally {
         if (newObj)
            ctx.popCurrentObject();
         ctx.popFrame();
      }
      return sb == null ? null : sb.toString();
   }
/**
    * Overrides the value node eval method where expectedType should be String.class.  The current object
    * used for the body of the template code is either set with ctx.pushCurrentObject or created by setting Template.createInstance = true.
    * In that case, rootType is used as the class.  It is created with a zero-arg constructor.
    */
Overrides the value node eval method where expectedType should be String.class.  The current object
used for the body of the template code is either set with ctx.pushCurrentObject or created by setting Template.createInstance = true.
In that case, rootType is used as the class.  It is created with a zero-arg constructor.
Overrides the value node eval method where expectedType should be String . class . The current object used for the body of the template code is either set with ctx . pushCurrentObject or created by setting Template . createInstance = true . In that case rootType is used as the class . It is created with a zero - arg constructor .
public Object eval(Class expectedType, ExecutionContext ctx) {
      StringBuilder sb = null;
      boolean newObj = false;
      ctx.pushFrame(true, 1);
      try {
         if (outputMethod == null) {
            sb = new StringBuilder();
            ctx.defineVariable("out", sb);
            OutputCtx octx = new OutputCtx();
            ctx.defineVariable("ctx", octx);
         }
         if (createInstance && rootType != null) {
            ctx.pushCurrentObject(ModelUtil.createInstance(rootType, null, new ArrayList<Expression>(0), ctx));
            newObj = true;
         }
         if (outputRuntimeMethod != null) {
            sb = (StringBuilder) ModelUtil.invokeMethod(ctx.getCurrentObject(), outputRuntimeMethod, null, ctx);
         }
         else if (outputMethod != null) {
            if (outputMethod.getNumParameters() == 0)
               sb = (StringBuilder) outputMethod.invoke(ctx, null); 
            else
               displayError("OutputMethod generated for template has parameters: " + outputMethod.name + " No method named 'output' for template eval");
         }
         else {
            if (templateDeclarations != null)
               ModelUtil.execTemplateDeclarations(sb, ctx, templateDeclarations);
         }
      }
      finally {
         if (newObj)
            ctx.popCurrentObject();
         ctx.popFrame();
      }
      return sb == null ? null : sb.toString();
   }
public Object eval ( Class expectedType , ExecutionContext ctx ) { StringBuilder sb = null ; boolean newObj = false ; ctx . pushFrame ( true , 1 ) ; try { if ( outputMethod == null ) { sb = new StringBuilder ( ) ; ctx . defineVariable ( "out" , sb ) ; OutputCtx octx = new OutputCtx ( ) ; ctx . defineVariable ( "ctx" , octx ) ; } if ( createInstance && rootType != null ) { ctx . pushCurrentObject ( ModelUtil . createInstance ( rootType , null , new ArrayList < Expression > ( 0 ) , ctx ) ) ; newObj = true ; } if ( outputRuntimeMethod != null ) { sb = ( StringBuilder ) ModelUtil . invokeMethod ( ctx . getCurrentObject ( ) , outputRuntimeMethod , null , ctx ) ; } else if ( outputMethod != null ) { if ( outputMethod . getNumParameters ( ) == 0 ) sb = ( StringBuilder ) outputMethod . invoke ( ctx , null ) ; else displayError ( "OutputMethod generated for template has parameters: " + outputMethod . name + " No method named 'output' for template eval" ) ; } else { if ( templateDeclarations != null ) ModelUtil . execTemplateDeclarations ( sb , ctx , templateDeclarations ) ; } } finally { if ( newObj ) ctx . popCurrentObject ( ) ; ctx . popFrame ( ) ; } return sb == null ? null : sb . toString ( ) ; }
Overrides the value node eval method where expectedType should be String.class.
Overrides the value node eval method where expectedType should be String . class .
// TODO: any cases where we need to pass params here?  I think this is just web.scxml