Class IterateContext
java.lang.Object
com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements.IterateContext
- All Implemented Interfaces:
Iterator
The Class IterateContext.
- Author:
- Brandon Goodin
-
Constructor Summary
ConstructorDescriptionIterateContext
(Object collection, SqlTag tag, IterateContext parent) Instantiates a new iterate context. -
Method Summary
Modifier and TypeMethodDescriptionprotected Map
Adds index value to the first found property matching this Iteration starting at index startIndex.addIndexToTagProperty
(String tagProperty) Replaces value of a tag property to match it's value with current iteration and all other iterations.Returns the last property of any bean specified in this IterateContext.int
getIndex()
Gets the index.Gets the parent.Gets the property.getTag()
Gets the tag.boolean
hasNext()
boolean
Checks if is allow next.boolean
isFinal()
Checks if is final.boolean
isFirst()
Deprecated.This method should not be used to decide whether or not to add prepend and open text to the generated statement.boolean
isLast()
Checks if is last.boolean
Checks if is prepend enabled.next()
protected Map
processTagProperty
(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) Sets the allow next.void
setFinal
(boolean aFinal) This attribute is used to mark whether an iterate tag is in it's final iteration.void
setParent
(IterateContext parent) Sets the parent.void
setPrependEnabled
(boolean isPrependEnabled) Sets the prepend enabled.void
setProperty
(String property) This property specifies whether to increment the iterate in the doEndFragment.void
setSomeSubElementsHaveContent
(boolean someSubElementsHaveContent) Sets the some sub elements have content.void
Sets the tag.boolean
Some sub elements have content.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
IterateContext
Instantiates a new iterate context.- Parameters:
collection
- the collectiontag
- the tagparent
- the parent
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
getIndex
public int getIndex()Gets the index.- Returns:
- the index
-
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().Checks if is first.- Returns:
- true, if is first
-
isLast
public boolean isLast()Checks if is last.- Returns:
- true, if is last
-
getProperty
Gets the property.- Returns:
- Returns the property.
-
setProperty
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()Checks if is allow next.- Returns:
- Returns the allowNext.
-
setAllowNext
public void setAllowNext(boolean performIterate) Sets the allow next.- Parameters:
performIterate
- The allowNext to set.
-
getTag
Gets the tag.- Returns:
- Returns the tag.
-
setTag
Sets the tag.- Parameters:
tag
- The tag to set.
-
isFinal
public boolean isFinal()Checks if is final.- Returns:
- true, if is final
-
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
- the new final
-
getEndProperty
Returns the last property of any bean specified in this IterateContext.- Returns:
- The last property of any bean specified in this IterateContext.
-
processTagProperty
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
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
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
Gets the parent.- Returns:
- the parent
-
setParent
Sets the parent.- Parameters:
parent
- the new parent
-
someSubElementsHaveContent
public boolean someSubElementsHaveContent()Some sub elements have content.- Returns:
- true, if successful
-
setSomeSubElementsHaveContent
public void setSomeSubElementsHaveContent(boolean someSubElementsHaveContent) Sets the some sub elements have content.- Parameters:
someSubElementsHaveContent
- the new some sub elements have content
-
isPrependEnabled
public boolean isPrependEnabled()Checks if is prepend enabled.- Returns:
- true, if is prepend enabled
-
setPrependEnabled
public void setPrependEnabled(boolean isPrependEnabled) Sets the prepend enabled.- Parameters:
isPrependEnabled
- the new prepend enabled
-