Package org.kiwiproject.beta.base.jar
Record Class AttributesLookupResult
java.lang.Object
java.lang.Record
org.kiwiproject.beta.base.jar.AttributesLookupResult
- Record Components:
lookupStatus- the lookup statusattributes- a map containing the attributes, or null if the lookup failed for any reasonerror- 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 Summary
ConstructorsConstructorDescriptionAttributesLookupResult(AttributesLookupStatus lookupStatus, @Nullable Map<String, String> attributes, @Nullable Exception error) Creates an instance of aAttributesLookupResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributesrecord component.final booleanIndicates whether some other object is "equal to" this one.@Nullable Exceptionerror()Returns the value of theerrorrecord component.booleanfailed()booleanfinal inthashCode()Returns a hash code value for this object.Returns the value of thelookupStatusrecord component.booleanfinal StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
AttributesLookupResult
public AttributesLookupResult(AttributesLookupStatus lookupStatus, @Nullable Map<String, String> attributes, @Nullable Exception error) Creates an instance of aAttributesLookupResultrecord class.- Parameters:
lookupStatus- the value for thelookupStatusrecord componentattributes- the value for theattributesrecord componenterror- the value for theerrorrecord 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
- Returns:
- an Optional wrapping the attributes
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
lookupStatus
Returns the value of thelookupStatusrecord component.- Returns:
- the value of the
lookupStatusrecord component
-
attributes
Returns the value of theattributesrecord component.- Returns:
- the value of the
attributesrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-