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 aQuantityWithCost
record class. -
Method Summary
Modifier and TypeMethodDescriptionadd
(QuantityWithCost another) Add another instance to this instance and return the resulted instance.cost()
Returns the value of thecost
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.quantity()
Returns the value of thequantity
record component.subtract
(QuantityWithCost another) Subtract another instance to this instance and return the resulted instance.final String
toString()
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
-