Class DefaultErrorHit

java.lang.Object
com.yahoo.component.provider.FreezableClass
com.yahoo.component.provider.ListenableFreezableClass
com.yahoo.search.result.Hit
com.yahoo.search.result.DefaultErrorHit
All Implemented Interfaces:
com.yahoo.component.provider.Freezable, com.yahoo.component.provider.ListenableFreezable, com.yahoo.processing.response.Data, ErrorHit, Cloneable, Comparable<Hit>

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

    • DefaultErrorHit

      public DefaultErrorHit(String source, ErrorMessage error)
      Creates an error hit with one error
      Parameters:
      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(String source, List<ErrorMessage> errors)
      Creates an error hit with a list of errors
      Parameters:
      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 Details

    • setSource

      public void setSource(String source)
      Description copied from class: Hit
      Sets the name of the source creating this hit
      Specified by:
      setSource in interface ErrorHit
      Overrides:
      setSource in class Hit
    • addError

      public void addError(ErrorMessage error)
      Adds an error to this
      Specified by:
      addError in interface ErrorHit
    • addErrors

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

      public 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 Set<ErrorMessage> errors()
      Returns a read-only set containing all the error of this
      Specified by:
      errors in interface ErrorHit
    • toString

      public String toString()
      Overrides:
      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
      Overrides:
      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
    • clone

      public DefaultErrorHit clone()
      Specified by:
      clone in interface ErrorHit
      Overrides:
      clone in class Hit