Record Class AttributesLookupResult

java.lang.Object
java.lang.Record
org.kiwiproject.beta.base.jar.AttributesLookupResult
Record Components:
lookupStatus - the lookup status
attributes - a map containing the attributes 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

public record AttributesLookupResult(AttributesLookupStatus lookupStatus, @Nullable Map<String,String> attributes, @Nullable Exception error) extends Record
A record that contains a lookup status and, if the lookup succeeded, a map of all the attributes.
  • Constructor Details

    • AttributesLookupResult

      public AttributesLookupResult(AttributesLookupStatus lookupStatus, @Nullable Map<String,String> attributes, @Nullable Exception error)
      Creates an instance of a AttributesLookupResult record class.
      Parameters:
      lookupStatus - the value for the lookupStatus record component
      attributes - the value for the attributes record component
      error - the value for the error 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
    • hasAttributes

      public boolean hasAttributes()
      Returns:
      true if, and only if, attributes is not null
    • maybeAttributes

      public Optional<Map<String,String>> maybeAttributes()
      Returns:
      an Optional wrapping the attributes
    • 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 AttributesLookupStatus lookupStatus()
      Returns the value of the lookupStatus record component.
      Returns:
      the value of the lookupStatus record component
    • attributes

      public @Nullable Map<String,String> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component
    • error

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