Record Class PriceLookup<T>
java.lang.Object
java.lang.Record
com.eqixiac.equinix.design.value.ratecard.PriceLookup<T>
- Type Parameters:
T- the figure's type (PriceQuoteorEgressRate)- Record Components:
value- the figure, ornullwhen unpricedunpricedReason- why there is no figure;nullwhenvalueis presentansweredBy- the card that produced the figure (itsRateCard.cardName()), ornullwhen unpricedtrail- what each consulted card said, in order (one entry per card for a layered card; empty for a single card)
public record PriceLookup<T>(T value, String unpricedReason, String answeredBy, List<String> trail)
extends Record
The answer to one rate-card lookup: the figure, or the reason there is none, plus which card
answered and why earlier cards declined. It is the explainable form of the
Optional
the plain RateCard methods return, for callers that must tell a reader why an item is
unpriced.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theansweredByrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisPriced()<R> PriceLookup<R> static <T> PriceLookup<T> Adapts a plainOptionalresult.static <T> PriceLookup<T> reason()final StringtoString()Returns a string representation of this record class.trail()Returns the value of thetrailrecord component.static <T> PriceLookup<T> Returns the value of theunpricedReasonrecord component.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
PriceLookup
-
-
Method Details
-
priced
- Type Parameters:
T- the figure's type- Parameters:
value- the figureansweredBy- the card that produced it- Returns:
- a priced lookup
-
unpriced
- Type Parameters:
T- the figure's type- Parameters:
reason- why the item cannot be priced- Returns:
- an unpriced lookup
-
of
Adapts a plainOptionalresult.- Type Parameters:
T- the figure's type- Parameters:
result- the plain resultansweredBy- the card's namereason- the reason to state whenresultis empty- Returns:
- the lookup
-
isPriced
public boolean isPriced()- Returns:
truewhen there is a figure
-
toOptional
-
reason
-
map
- Type Parameters:
R- the new type- Parameters:
mapper- transforms the figure- Returns:
- a lookup with the mapped figure and the same reason, card and trail
-
withTrail
- Parameters:
entries- the trail to attach- Returns:
- a copy with the trail replaced
-
toString
-
hashCode
-
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). -
value
-
unpricedReason
Returns the value of theunpricedReasonrecord component.- Returns:
- the value of the
unpricedReasonrecord component
-
answeredBy
Returns the value of theansweredByrecord component.- Returns:
- the value of the
answeredByrecord component
-
trail
-