Class ListQuestion.Body

  • Enclosing class:
    ListQuestion

    public abstract static class ListQuestion.Body
    extends Interview
    A special subtype of Interview to use for the questions in the body of a loop. The body has an index, which identifies its position within the list of current loop bodies, and a summary string to identify this instance of the loop body.
    • Constructor Detail

      • Body

        protected Body​(ListQuestion question,
                       int index)
        Create an instance of a loop body.
        Parameters:
        question - The loop question for which this is a body instance.
        index - The position of this body within the set of all the bodies. The value is normally just a hint (albeit a possibly string one). The index will be updated if necessary when the body is actually set as one of the bodies of the loop.
    • Method Detail

      • getSummary

        public abstract java.lang.String getSummary()
        Get a string to uniquely identify this instance of the loop body, or null if there is insufficient information so far to make a determination. The string will be used to identify the loop body to the user.
        Returns:
        a string to uniquely identify this instance of the loop body, or null if there is insufficient information so far to make a determination.
      • getIndex

        public int getIndex()
        Get the position of this loop body within the set of all the loop bodies for the question.
        Returns:
        the position of this loop body within the set of all the loop bodies for the question
      • getDefaultSummary

        public java.lang.String getDefaultSummary()
        Get a default summary to be used to identify this instance of the the loop body, to be used when getSummary() returns null. The summary will be a standard prefix string possibly followed by a number to distinguish between multiple bodies using the default summary. The default summary will be unique and persist for the life of this body or until getSummary() returns a non-null value.
        Returns:
        a default summary to be used to identify this instance of the the loop body, to be used when getSummary() returns null.
      • isBodyFinishable

        public boolean isBodyFinishable()
        Check if this body has been completed. It is considered to have been completed if none of the questions in this body on the current path return null as the result of getNext().
        Returns:
        true is this body has been completed.