1 package tests.jfun.yan.xml; 2 3 import jfun.yan.Component; 4 import jfun.yan.Mutation; 5 import jfun.yan.xml.nuts.MethodNut; 6 7 public class MyMethodNut extends MethodNut { 8 private boolean echo = false; 9 10 public boolean isEcho() { 11 return echo; 12 } 13 14 public void setEcho(boolean echo) { 15 this.echo = echo; 16 } 17 18 public Component eval() { 19 final Component r = super.eval(); 21 if(echo){ 22 final String msg = (String )this.getNutEnvironment().findService("echo_msg"); 23 if(msg == null) 24 throw raise("echo_msg not found."); 25 return r.mutate(new Mutation(){ 26 public void mutate(Object r){ 27 System.out.println(msg + r +" constructed."); 28 } 29 }); 30 } 31 else{ 32 return r; 33 } 34 } 35 36 } 37 | Popular Tags |