Package jfun.yan.xml.nuts

Source Code of jfun.yan.xml.nuts.BindNut

package jfun.yan.xml.nuts;

import jfun.yan.Binder;
import jfun.yan.Component;

/**
* Nut class for <bind> tag.
* <p>
* The "followup" attribute specifies if the binder is only intended to do some
* side-effect, and the object returned by the bound component is still used
* as return value.
* </p>
* <p>
* "followup"="true" allows mutual dependency on singleton because the return object
* can be cached in the singleton before the mutaion is executed.
* </p>
* <p>
* default value for "followup" is false.
* </p>
* <p>
* @author Ben Yu
* Nov 9, 2005 11:41:18 PM
*/
public class BindNut extends DelegatingNut {
  private Binder binder;
  private boolean followup = false;
 
  public boolean isFollowup() {
    return followup;
  }

  public void setFollowup(boolean followup) {
    this.followup = followup;
  }

  public Binder getBinder() {
    return binder;
  }

  public void setBinder(Binder binder) {
    this.binder = binder;
  }


  public Component eval(){
    final Component c1 = getMandatory();
    checkMandatory("binder", binder);
    return followup?c1.followedBy(binder):c1.bind(binder);
  }

}
TOP

Related Classes of jfun.yan.xml.nuts.BindNut

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.