Class DefaultErrorHit

  • All Implemented Interfaces:,,, ErrorHit, java.lang.Cloneable, java.lang.Comparable<Hit>

    public class DefaultErrorHit
    extends Hit
    implements ErrorHit, java.lang.Cloneable
    A hit which holds a list of error conditions in a result.
    bratseth, Steinar Knutsen
    • Constructor Detail

      • DefaultErrorHit

        public DefaultErrorHit​(java.lang.String source,
                               ErrorMessage error)
        Creates an error hit with one error
        source - the name of the source or backend of this hit
        error - an initial error to add to this hit, cannot be null
      • DefaultErrorHit

        public DefaultErrorHit​(java.lang.String source,
                               java.util.List<ErrorMessage> errors)
        Creates an error hit with a list of errors
        source - the name of the source or backend of this hit
        errors - a list of errors for this to hold. The list will not be modified or retained.
    • Method Detail

      • setSource

        public void setSource​(java.lang.String source)
        Description copied from class: Hit
        Sets the name of the source creating this hit
        Specified by:
        setSource in interface ErrorHit
        setSource in class Hit
      • addErrors

        public void addErrors​(ErrorHit errorHit)
        Add all errors from another error hit to this
        Specified by:
        addErrors in interface ErrorHit
      • errorIterator

        public java.util.Iterator<ErrorMessage> errorIterator()
        Returns all the detail errors of this error hit, not including the main error. The iterator is modifiable.
        Specified by:
        errorIterator in interface ErrorHit
      • errors

        public java.util.Set<ErrorMessage> errors()
        Returns a read-only set containing all the error of this
        Specified by:
        errors in interface ErrorHit
      • toString

        public java.lang.String toString()
        toString in class Hit
      • isMeta

        public boolean isMeta()
        Returns true - this is a meta hit containing information on other hits
        Specified by:
        isMeta in interface ErrorHit
        isMeta in class Hit
      • hasOnlyErrorCode

        public boolean hasOnlyErrorCode​(int code)
        Returns true if all errors in this have the given code
        Specified by:
        hasOnlyErrorCode in interface ErrorHit