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

Class IterateContext

public class IterateContext extends Object implements Iterator

Author: Brandon Goodin

Constructor Summary
IterateContext(Object collection, SqlTag tag, IterateContext parent)
Method Summary
protected MapaddIndex(String input, int startIndex)
Adds index value to the first found property matching this Iteration starting at index startIndex.
StringaddIndexToTagProperty(String tagProperty)
Replaces value of a tag property to match it's value with current iteration and all other iterations.
StringgetEndProperty()
Returns the last property of any bean specified in this IterateContext.
intgetIndex()
IterateContextgetParent()
StringgetProperty()
SqlTaggetTag()
booleanhasNext()
booleanisAllowNext()
booleanisFinal()
booleanisFirst()
booleanisLast()
booleanisPrependEnabled()
Objectnext()
protected MapprocessTagProperty(String tagProperty)
Replaces value of a tag property to match it's value with current iteration and all other iterations.
voidremove()
voidsetAllowNext(boolean performIterate)
voidsetFinal(boolean aFinal)
This attribute is used to mark whether an iterate tag is in it's final iteration.
voidsetParent(IterateContext parent)
voidsetPrependEnabled(boolean isPrependEnabled)
voidsetProperty(String property)
This property specifies whether to increment the iterate in the doEndFragment.
voidsetSomeSubElementsHaveContent(boolean someSubElementsHaveContent)
voidsetTag(SqlTag tag)
booleansomeSubElementsHaveContent()

Constructor Detail

IterateContext

public IterateContext(Object collection, SqlTag tag, IterateContext parent)

Method Detail

addIndex

protected Map addIndex(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.

addIndexToTagProperty

public String addIndexToTagProperty(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.

getEndProperty

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

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

getIndex

public int getIndex()

getParent

public IterateContext getParent()

getProperty

public String getProperty()

Returns: Returns the property.

getTag

public SqlTag getTag()

Returns: Returns the tag.

hasNext

public boolean hasNext()

isAllowNext

public boolean isAllowNext()

Returns: Returns the allowNext.

isFinal

public boolean isFinal()

Returns:

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()

isPrependEnabled

public boolean isPrependEnabled()

next

public Object next()

processTagProperty

protected Map processTagProperty(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.

remove

public void remove()

setAllowNext

public void setAllowNext(boolean performIterate)

Parameters: performIterate The allowNext to set.

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

setParent

public void setParent(IterateContext parent)

setPrependEnabled

public void setPrependEnabled(boolean isPrependEnabled)

setProperty

public void setProperty(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.

setSomeSubElementsHaveContent

public void setSomeSubElementsHaveContent(boolean someSubElementsHaveContent)

setTag

public void setTag(SqlTag tag)

Parameters: tag The tag to set.

someSubElementsHaveContent

public boolean someSubElementsHaveContent()
Copyright © 2011. All Rights Reserved.