Record Class PortfolioCost

java.lang.Object
java.lang.Record
com.eqixiac.equinix.design.spi.PortfolioCost
Record Components:
lines - the priced items
unpriced - what could not be priced and why (one entry per item); a non-empty list means every total understates the real cost

public record PortfolioCost(List<CostLine> lines, List<String> unpriced) extends Record
The priced lines of one portfolio plus the items that could not be priced. Totals are offered only when every line shares one currency: amounts in different currencies are never added.
  • Constructor Details

    • PortfolioCost

      public PortfolioCost(List<CostLine> lines, List<String> unpriced)
      Makes both lists immutable and non-null.
  • Method Details

    • currencies

      public Set<String> currencies()
      Returns:
      the distinct currencies of the lines, sorted
    • isComplete

      public boolean isComplete()
      Returns:
      true when nothing was left unpriced
    • monthlyTotal

      public Optional<BigDecimal> monthlyTotal()
      Returns:
      the expected monthly total, or empty when there are no lines or the lines span currencies
    • monthlyLow

      public Optional<BigDecimal> monthlyLow()
      Returns:
      the low end of the monthly total, or empty as for monthlyTotal()
    • monthlyHigh

      public Optional<BigDecimal> monthlyHigh()
      Returns:
      the high end of the monthly total, or empty as for monthlyTotal()
    • oneTimeTotal

      public Optional<BigDecimal> oneTimeTotal()
      Returns:
      the one-time total, or empty as for monthlyTotal()
    • currency

      public Optional<String> currency()
      Returns:
      the single currency of the totals, or empty when there are no lines or several currencies
    • 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.
    • lines

      public List<CostLine> lines()
      Returns the value of the lines record component.
      Returns:
      the value of the lines record component
    • unpriced

      public List<String> unpriced()
      Returns the value of the unpriced record component.
      Returns:
      the value of the unpriced record component