Package tests.jfun.yan.xml

Source Code of tests.jfun.yan.xml.MyMethodNut

package tests.jfun.yan.xml;

import jfun.yan.Component;
import jfun.yan.Mutation;
import jfun.yan.xml.nuts.MethodNut;

public class MyMethodNut extends MethodNut {
  private boolean echo = false;

  public boolean isEcho() {
    return echo;
  }

  public void setEcho(boolean echo) {
    this.echo = echo;
  }

  public Component eval() {
    // TODO Auto-generated method stub
    final Component r = super.eval();
    if(echo){
      final String msg = (String)this.getNutEnvironment().findService("echo_msg");
      if(msg == null)
        throw raise("echo_msg not found.");
      return r.mutate(new Mutation(){
        public void mutate(Object r){
          System.out.println(msg + r +" constructed.");
        }
      });
    }
    else{
      return r;
    }
  }
 
}
TOP

Related Classes of tests.jfun.yan.xml.MyMethodNut

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.