Package com.storedobject.core
Record Class QuantityWithCost
java.lang.Object
java.lang.Record
com.storedobject.core.QuantityWithCost
-
Constructor Summary
ConstructorsConstructorDescriptionQuantityWithCost(Quantity quantity, Money cost) Creates an instance of aQuantityWithCostrecord class. -
Method Summary
Modifier and TypeMethodDescriptionadd(QuantityWithCost another) Add another instance to this instance and return the resulted instance.cost()Returns the value of thecostrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.quantity()Returns the value of thequantityrecord component.subtract(QuantityWithCost another) Subtract another instance to this instance and return the resulted instance.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
QuantityWithCost
-
-
Method Details
-
add
Add another instance to this instance and return the resulted instance.- Parameters:
another- Another instance.- Returns:
- New instance.
-
subtract
Subtract another instance to this instance and return the resulted instance.- Parameters:
another- Another instance.- Returns:
- New instance.
-
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). -
quantity
-
cost
-