com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements
Class IterateContext

java.lang.Object
  extended bycom.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.IterateContext
All Implemented Interfaces:
java.util.Iterator

public class IterateContext
extends java.lang.Object
implements java.util.Iterator

Author:
Brandon Goodin

Constructor Summary
IterateContext(java.lang.Object collection, SqlTag tag, IterateContext parent)
           
 
Method Summary
protected  java.util.Map addIndex(java.lang.String input, int startIndex)
          Adds index value to the first found property matching this Iteration starting at index startIndex.
 java.lang.String addIndexToTagProperty(java.lang.String tagProperty)
          Replaces value of a tag property to match it's value with current iteration and all other iterations.
 java.lang.String getEndProperty()
          Returns the last property of any bean specified in this IterateContext.
 int getIndex()
           
 IterateContext getParent()
           
 java.lang.String getProperty()
           
 SqlTag getTag()
           
 boolean hasNext()
           
 boolean isAllowNext()
           
 boolean isFinal()
           
 boolean isFirst()
          Deprecated. This method should not be used to decide whether or not to add prepend and open text to the generated statement. Rather, use the methods isPrependEnabled() and someSubElementsHaveContent().
 boolean isLast()
           
 boolean isPrependEnabled()
           
 java.lang.Object next()
           
protected  java.util.Map processTagProperty(java.lang.String tagProperty)
          Replaces value of a tag property to match it's value with current iteration and all other iterations.
 void remove()
           
 void setAllowNext(boolean performIterate)
           
 void setFinal(boolean aFinal)
          This attribute is used to mark whether an iterate tag is in it's final iteration.
 void setParent(IterateContext parent)
           
 void setPrependEnabled(boolean isPrependEnabled)
           
 void setProperty(java.lang.String property)
          This property specifies whether to increment the iterate in the doEndFragment.
 void setSomeSubElementsHaveContent(boolean someSubElementsHaveContent)
           
 void setTag(SqlTag tag)
           
 boolean someSubElementsHaveContent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IterateContext

public IterateContext(java.lang.Object collection,
                      SqlTag tag,
                      IterateContext parent)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator

remove

public void remove()
Specified by:
remove in interface java.util.Iterator

getIndex

public int getIndex()

isFirst

public boolean isFirst()
Deprecated. This method should not be used to decide whether or not to add prepend and open text to the generated statement. Rather, use the methods isPrependEnabled() and someSubElementsHaveContent().

Returns:

isLast

public boolean isLast()

getProperty

public java.lang.String getProperty()
Returns:
Returns the property.

setProperty

public void setProperty(java.lang.String property)
This property specifies whether to increment the iterate in the doEndFragment. The ConditionalTagHandler has the ability to increment the IterateContext, so it is neccessary to avoid incrementing in both the ConditionalTag and the IterateTag.

Parameters:
property - The property to set.

isAllowNext

public boolean isAllowNext()
Returns:
Returns the allowNext.

setAllowNext

public void setAllowNext(boolean performIterate)
Parameters:
performIterate - The allowNext to set.

getTag

public SqlTag getTag()
Returns:
Returns the tag.

setTag

public void setTag(SqlTag tag)
Parameters:
tag - The tag to set.

isFinal

public boolean isFinal()
Returns:

setFinal

public void setFinal(boolean aFinal)
This attribute is used to mark whether an iterate tag is in it's final iteration. Since the ConditionalTagHandler can increment the iterate the final iterate in the doEndFragment of the IterateTagHandler needs to know it is in it's final iterate.

Parameters:
aFinal -

getEndProperty

public java.lang.String getEndProperty()
Returns the last property of any bean specified in this IterateContext.

Returns:
The last property of any bean specified in this IterateContext.

processTagProperty

protected java.util.Map processTagProperty(java.lang.String tagProperty)
Replaces value of a tag property to match it's value with current iteration and all other iterations.

Parameters:
tagProperty - the property of a TagHandler.
Returns:
A Map containing the modified tag property in PROCESS_STRING key and the index where the modification occured in PROCESS_INDEX key.

addIndexToTagProperty

public java.lang.String addIndexToTagProperty(java.lang.String tagProperty)
Replaces value of a tag property to match it's value with current iteration and all other iterations.

Parameters:
tagProperty - the property of a TagHandler.
Returns:
The tag property with all "[]" replaced with the correct iteration value.

addIndex

protected java.util.Map addIndex(java.lang.String input,
                                 int startIndex)
Adds index value to the first found property matching this Iteration starting at index startIndex.

Parameters:
input - The input String.
startIndex - The index where search for property begins.
Returns:
A Map containing the modified tag property in PROCESS_STRING key and the index where the modification occured in PROCESS_INDEX key.

getParent

public IterateContext getParent()

setParent

public void setParent(IterateContext parent)

someSubElementsHaveContent

public boolean someSubElementsHaveContent()

setSomeSubElementsHaveContent

public void setSomeSubElementsHaveContent(boolean someSubElementsHaveContent)

isPrependEnabled

public boolean isPrependEnabled()

setPrependEnabled

public void setPrependEnabled(boolean isPrependEnabled)