jfun.yan.xml.nuts.optional
Class AbstractLoopRegisterNut

java.lang.Object
  extended by jfun.yan.xml.nut.Nut
      extended by jfun.yan.xml.nuts.optional.AbstractRegisterNut
          extended by jfun.yan.xml.nuts.optional.AbstractLoopRegisterNut
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ForeachRegisterNut, PropertiesRegisterNut

public abstract class AbstractLoopRegisterNut
extends AbstractRegisterNut

This class dynamically register components returned from the function body in each loop.

Author:
Ben Yu Dec 22, 2005 12:31:02 AM
See Also:
Serialized Form

Constructor Summary
AbstractLoopRegisterNut()
           
 
Method Summary
 void add(NutsFunction fun)
           
protected  java.lang.Object calcFQN(java.lang.Object id)
          Calculate the fully qualified name using the prefix and suffix.
protected  java.lang.Object[] createArgs(java.lang.Object val)
          Create an array containing prefix, suffix and another value.
protected  java.lang.Object[] createArgs(java.lang.Object val1, java.lang.Object val2)
          Create an array containing prefix, suffix and two other values.
 NutsFunction getBody()
           
protected  NutsFunction getMandatoryBody()
           
 java.lang.String getPrefix()
           
 java.lang.String getSuffix()
           
protected  void loop(java.lang.Object id, java.lang.Object val)
          Loop once by calling the body function and register the result.
protected  void loop(java.lang.Object id, java.lang.Object val1, java.lang.Object val2)
          Loop once by calling the body function and register the result.
 void setBody(NutsFunction body)
           
 void setPrefix(java.lang.String prefix)
           
 void setSuffix(java.lang.String postfix)
           
 
Methods inherited from class jfun.yan.xml.nuts.optional.AbstractRegisterNut
isEager_init, isEagerlyInstantiating, isOverridable, isOverriding, registerValue, setEager_init, setOverridable, setOverriding
 
Methods inherited from class jfun.yan.xml.nut.Nut
cast, checkDuplicate, checkMandatory, checkMandatory, convert, getComponentClassLoader, getId, getNutClassLoader, getNutEnvironment, getParameterWiring, getPropertyWiring, getSequenceNumber, getTagLocation, getTagName, initGloballyDefined, initNutEnvironment, initSequenceNumber, initTagLocation, initTagName, isGloballyDefined, raise, raise, register, registerEagerInstantiation, setId, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractLoopRegisterNut

public AbstractLoopRegisterNut()
Method Detail

getMandatoryBody

protected NutsFunction getMandatoryBody()

getBody

public NutsFunction getBody()

setBody

public void setBody(NutsFunction body)

getPrefix

public java.lang.String getPrefix()

setPrefix

public void setPrefix(java.lang.String prefix)

getSuffix

public java.lang.String getSuffix()

setSuffix

public void setSuffix(java.lang.String postfix)

add

public void add(NutsFunction fun)

calcFQN

protected java.lang.Object calcFQN(java.lang.Object id)
Calculate the fully qualified name using the prefix and suffix.

Parameters:
id - the id.
Returns:
the fully qualified id.

createArgs

protected java.lang.Object[] createArgs(java.lang.Object val)
Create an array containing prefix, suffix and another value. If prefix or suffix is not provided, it is omitted from the result array.

Parameters:
val - the value.
Returns:
the array.

createArgs

protected java.lang.Object[] createArgs(java.lang.Object val1,
                                        java.lang.Object val2)
Create an array containing prefix, suffix and two other values. If prefix or suffix is not specified, it is omitted from the array.

Parameters:
val1 - the first value.
val2 - the second value.
Returns:
the array.

loop

protected void loop(java.lang.Object id,
                    java.lang.Object val)
Loop once by calling the body function and register the result. prefix, suffix and the value is passed to the funciton. If prefix or suffix is not specified, it is omitted from the argument list.

Parameters:
id - the id for the registration.
val - the value for the loop.

loop

protected void loop(java.lang.Object id,
                    java.lang.Object val1,
                    java.lang.Object val2)
Loop once by calling the body function and register the result. prefix, suffix and the 2 values are passed to the funciton. If prefix or suffix is not specified, it is omitted from the argument list.

Parameters:
id - the id for the registration.
val1 - the first value.
val2 - the second value.