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;
}
}
}