Record Class ManifestLookupResult

java.lang.Object
java.lang.Record
org.kiwiproject.beta.base.jar.ManifestLookupResult
Record Components:
lookupStatus - the lookup status
manifest - the Manifest, or null if the lookup failed for any reason
error - the Exception that occurred during a failed lookup, or null if the cause was not an exception
errorMessage - an error message describing the cause of the lookup failure

public record ManifestLookupResult(ManifestLookupStatus lookupStatus, @Nullable Manifest manifest, @Nullable Exception error, @Nullable String errorMessage) extends Record
A record that contains lookup status and, if the lookup succeeded, a Manifest.
  • Constructor Details

    • ManifestLookupResult

      public ManifestLookupResult(ManifestLookupStatus lookupStatus, @Nullable Manifest manifest, @Nullable Exception error, @Nullable String errorMessage)
      Creates an instance of a ManifestLookupResult record class.
      Parameters:
      lookupStatus - the value for the lookupStatus record component
      manifest - the value for the manifest record component
      error - the value for the error record component
      errorMessage - the value for the errorMessage record component
  • Method Details

    • failed

      public boolean failed()
      Returns:
      true if the lookup failed for any reason, otherwise true
    • succeeded

      public boolean succeeded()
      Returns:
      true if the lookup succeeded, otherwise false
    • maybeManifest

      public Optional<Manifest> maybeManifest()
      Returns:
      an Optional wrapping the manifest
    • manifestOrThrow

      public Manifest manifestOrThrow()
      Return the Manifest if non-null. Otherwise, throw an IllegalStateException.
      Returns:
      the manifest if not-null
      Throws:
      IllegalStateException - if the Manifest is null
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • lookupStatus

      public ManifestLookupStatus lookupStatus()
      Returns the value of the lookupStatus record component.
      Returns:
      the value of the lookupStatus record component
    • manifest

      public @Nullable Manifest manifest()
      Returns the value of the manifest record component.
      Returns:
      the value of the manifest record component
    • error

      public @Nullable Exception error()
      Returns the value of the error record component.
      Returns:
      the value of the error record component
    • errorMessage

      public @Nullable String errorMessage()
      Returns the value of the errorMessage record component.
      Returns:
      the value of the errorMessage record component