Class MZTabErrorList


  • public class MZTabErrorList
    extends java.lang.Object
    A limit max capacity list, if contains a couple of MZTabError objects. If overflow, system will raise MZTabErrorOverflowException. Besides this, during add a new MZTabError object, it's MZTabErrorType.level SHOULD equal or great than its level setting.
    Since:
    29/01/13
    Author:
    qingwei
    • Method Detail

      • getErrorList

        public java.util.List<MZTabError> getErrorList()
        Unmodifiable list of errors
        Returns:
        error list
      • getMaxErrorCount

        public int getMaxErrorCount()

        Getter for the field maxErrorCount.

        Returns:
        The maximum number of errors that are going to be reported before the parser stops with an MZTabErrorOverflowException
      • setMaxErrorCount

        public void setMaxErrorCount​(int maxErrorCount)
        Define the maximum number of errors recorded by this list before an MZTabErrorOverflowException is thrown
        Parameters:
        maxErrorCount - needs to be a positive number or zero will be set
      • setLevel

        public void setLevel​(MZTabErrorType.Level level)
        Define the level of the errors that are going to be store in the list. The incoming errors with an equal or highest level will be stored.
        Parameters:
        level - MZTabErrorType.level
      • clear

        public void clear()
        Clear all errors stored in the error list.
      • size

        public int size()
        Returns the number of elements in this list.
        Returns:
        a int.
      • getError

        public MZTabError getError​(int index)
        Returns the element at the specified position in this list.
        Parameters:
        index - index of the element to return
        Returns:
        a MZTabError object.
      • isEmpty

        public boolean isEmpty()
        Returns true if this list contains no elements.
        Returns:
        a boolean.
      • print

        public void print​(java.io.OutputStream out)
                   throws java.io.IOException
        Print error list to output stream.
        Parameters:
        out - SHOULD NOT set null.
        Throws:
        java.io.IOException - if any.
      • toString

        public java.lang.String toString()
        Print error list to string.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String object.
      • convertToValidationMessages

        public static java.util.List<ValidationMessage> convertToValidationMessages​(MZTabErrorList errorList)
                                                                             throws java.lang.IllegalStateException
        Converts the provided error list to a list of validation messages.
        Parameters:
        errorList - the error list to convert.
        Returns:
        a list of validation messages.
        Throws:
        java.lang.IllegalStateException - for unhandled mappings of ValidationMessage.MessageTypeEnum.
      • convertToValidationMessages

        public java.util.List<ValidationMessage> convertToValidationMessages()
                                                                      throws java.lang.IllegalStateException
        Converts this error list to a list of validation messages.
        Returns:
        a list of validation messages.
        Throws:
        java.lang.IllegalStateException - for unhandled mappings of ValidationMessage.MessageTypeEnum.