Record Class MetricAmount
java.lang.Object
java.lang.Record
dev.archunitjava.metrics.MetricAmount
- All Implemented Interfaces:
Comparable<MetricAmount>
public record MetricAmount(BigDecimal value, MetricUnit unit)
extends Record
implements Comparable<MetricAmount>
Exact decimal metric amount paired with its non-interchangeable unit.
-
Constructor Summary
ConstructorsConstructorDescriptionMetricAmount(BigDecimal value, MetricUnit unit) Creates an instance of aMetricAmountrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(MetricAmount other) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static MetricAmountof(double value, MetricUnit unit) static MetricAmountof(long value, MetricUnit unit) final StringtoString()Returns a string representation of this record class.unit()Returns the value of theunitrecord component.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
MetricAmount
Creates an instance of aMetricAmountrecord class.- Parameters:
value- the value for thevaluerecord componentunit- the value for theunitrecord component
-
-
Method Details
-
of
-
of
-
stableValue
-
compareTo
- Specified by:
compareToin interfaceComparable<MetricAmount>
-
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). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
unit
Returns the value of theunitrecord component.- Returns:
- the value of the
unitrecord component
-