Class CompoundErrors

java.lang.Object
org.voltdb.utils.CompoundErrors

public final class CompoundErrors extends Object
Helper that can be used to collect multiple errors that are encountered, e.g. while validating the parameters of any Initializable class. This enables implementing a validation logic that will not stop at the first error, and return a message compounding multiple error messages.
  • Constructor Details

    • CompoundErrors

      public CompoundErrors()
  • Method Details

    • addErrorMessage

      public void addErrorMessage(String error)
      Add a new error message to the set of errors being returned from this validation
      Parameters:
      error - message to add. If null the message will be ignored
    • hasErrors

      public boolean hasErrors()
      Returns:
      true if errors have been added to this instance
    • getErrorMessage

      public String getErrorMessage()
      Creates an error message comprised of all of the error messages added to this instance by calling addErrorMessage(String). If no error messages were added then null is returned.

      This method uses a newline ('\n') character to separate the different error messages.

      Returns:
      An error message or null if hasErrors() returns false
    • getErrorMessage

      public String getErrorMessage(String separator)
      A specialized version of getErrorMessage(), using a specific separator.
      Parameters:
      separator - String separating individual error messages in the final string.
      Returns:
      An error message or null if hasErrors() returns false