Package jfun.yan.xml.nuts.optional

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

package jfun.yan.xml.nuts.optional;

import jfun.yan.Component;

/**
* This tag dynamically registers components under dynamic ids.
* <p>
* @author Ben Yu
* Dec 21, 2005 10:18:00 PM
*/
public class RegisterNut extends AbstractRegisterNut {
  private Object[] ids;
  private Component[] vals;
  public Object[] getIds() {
    return ids;
  }
  public void setIds(Object[] ids) {
    this.ids = ids;
  }
  public Component[] getVals() {
    return vals;
  }
  public void setVals(Component[] vals) {
    this.vals = vals;
  }
  public void eval(){
    checkMandatory("ids", ids);
    checkMandatory("vals", vals);
    if(ids.length!=vals.length){
      throw raise("the number of ids should be the same as the number of vals. "+ids.length
          + "!="+vals.length);
    }
    for(int i=0; i<ids.length; i++){
      final Object id = ids[i];
      final Component val = vals[i];
      super.registerValue(id, val);
    }
  }
}
TOP

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

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.