Package jfun.yan.xml.nuts.optional

Source Code of jfun.yan.xml.nuts.optional.PrintNut

package jfun.yan.xml.nuts.optional;

import jfun.yan.Component;
import jfun.yan.SimpleComponent;
import jfun.yan.xml.nut.ComponentNut;

/**
* A Nut class that prints a message to the standard output
* when evaluated.
* <p>
* @author Ben Yu
* Nov 10, 2005 12:07:50 AM
*/
public class PrintNut extends ComponentNut {
  private Object msg;
 
  public void setMsg(Object msg) {
    this.msg = msg;
  }

  public Object getMsg() {
    return msg;
  }

  public Component eval(){
    checkMandatory("msg", msg);
    return new SimpleComponent(boolean.class){
      public Object create(){
        System.out.println(msg);
        return Boolean.valueOf(true);
      }
    };
  }
}
TOP

Related Classes of jfun.yan.xml.nuts.optional.PrintNut

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.