Record Class Debt

java.lang.Object
java.lang.Record
com.truebubo.maniflow.debt.Debt
Record Components:
value - How much is the new debt
currencyDesignation - What currency the debt is in
yearlyInterest - Interest rate on the debt
created - Timestamp of when the new debt was approved

public record Debt(BigDecimal value, CurrencyDesignation currencyDesignation, BigDecimal yearlyInterest, Instant created) extends Record
Information about debt
  • Constructor Details

    • Debt

      public Debt(@NonNull BigDecimal value, @NonNull CurrencyDesignation currencyDesignation, @NonNull BigDecimal yearlyInterest, @NonNull Instant created)
      Creates an instance of a Debt record class.
      Parameters:
      value - the value for the value record component
      currencyDesignation - the value for the currencyDesignation record component
      yearlyInterest - the value for the yearlyInterest record component
      created - the value for the created record component
  • Method Details

    • getValueWithInterest

      public BigDecimal getValueWithInterest()
      How much is the debt now including the interest that accumulated since last updates
      Returns:
      Value with interest
    • 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.
    • value

      @NonNull public BigDecimal value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • currencyDesignation

      @NonNull public CurrencyDesignation currencyDesignation()
      Returns the value of the currencyDesignation record component.
      Returns:
      the value of the currencyDesignation record component
    • yearlyInterest

      @NonNull public BigDecimal yearlyInterest()
      Returns the value of the yearlyInterest record component.
      Returns:
      the value of the yearlyInterest record component
    • created

      @NonNull public Instant created()
      Returns the value of the created record component.
      Returns:
      the value of the created record component