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

public class IterateContext extends Object implements Iterator
The Class IterateContext.
Author:
Brandon Goodin
  • Constructor Details

    • IterateContext

      public IterateContext(Object collection, SqlTag tag, IterateContext parent)
      Instantiates a new iterate context.
      Parameters:
      collection - the collection
      tag - the tag
      parent - the parent
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator
    • next

      public Object next()
      Specified by:
      next in interface Iterator
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator
    • 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

      public String getProperty()
      Gets the property.
      Returns:
      Returns the property.
    • 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.
    • 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

      public SqlTag getTag()
      Gets the tag.
      Returns:
      Returns the tag.
    • setTag

      public void setTag(SqlTag tag)
      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

      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.
    • 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.
    • 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.
    • 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.
    • getParent

      public IterateContext getParent()
      Gets the parent.
      Returns:
      the parent
    • setParent

      public void setParent(IterateContext parent)
      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