Record Class Rate
java.lang.Object
java.lang.Record
net.thauvin.erik.frankfurter.models.Rate
- Record Components:
date- the date the exchange rate was recordedbase- the base currency code (e.g."EUR")quote- the quote currency code (e.g."AED")exchangeRate- the exchange rate from base to quote currency
- All Implemented Interfaces:
RateResult
@NullMarked
public record Rate(LocalDate date, String base, String quote, double exchangeRate)
extends Record
implements RateResult
Represents a currency exchange rate between a base and quote currency on a given date.
- Since:
- 1.0
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbase()Returns the value of thebaserecord component.date()Returns the value of thedaterecord component.final booleanIndicates whether some other object is "equal to" this one.doubleReturns the value of theexchangeRaterecord component.final inthashCode()Returns a hash code value for this object.quote()Returns the value of thequoterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Rate
Creates an instance of aRaterecord class.- Parameters:
date- the value for thedaterecord componentbase- the value for thebaserecord componentquote- the value for thequoterecord componentexchangeRate- the value for theexchangeRaterecord component
-
-
Method Details
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
date
Returns the value of thedaterecord component.- Returns:
- the value of the
daterecord component
-
base
Returns the value of thebaserecord component.- Returns:
- the value of the
baserecord component
-
quote
Returns the value of thequoterecord component.- Returns:
- the value of the
quoterecord component
-
exchangeRate
Returns the value of theexchangeRaterecord component.- Returns:
- the value of the
exchangeRaterecord component
-