java.lang.Object
org.tquadrat.foundation.value.api.ValueBase<Temperature,TemperatureValue>
org.tquadrat.foundation.value.TemperatureValue
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<DimensionedValue<Temperature>>
,Formattable
,DimensionedValue<Temperature>
@ClassVersion(sourceVersion="$Id: TemperatureValue.java 1072 2023-09-30 20:44:38Z tquadrat $")
@API(status=STABLE,
since="0.1.0")
public final class TemperatureValue
extends ValueBase<Temperature,TemperatureValue>
A value class for temperatures.
- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: TemperatureValue.java 1072 2023-09-30 20:44:38Z tquadrat $
- Since:
- 0.1.0
- See Also:
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.value.TemperatureValue"
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BiPredicate
<Temperature, BigDecimal> The validator for temperatures.Fields inherited from class org.tquadrat.foundation.value.api.ValueBase
DEFAULT_VALIDATOR
Fields inherited from interface org.tquadrat.foundation.value.api.DimensionedValue
MATH_CONTEXT
-
Constructor Summary
ConstructorsConstructorDescriptionTemperatureValue
(Temperature dimension, String value) Creates a newTemperatureValue
instance.TemperatureValue
(Temperature dimension, BigDecimal value) Creates a newTemperatureValue
instance.TemperatureValue
(Temperature dimension, N value) Creates a newLengthValue
instance. -
Method Summary
Modifier and TypeMethodDescriptionfinal TemperatureValue
clone()
Creates a new copy of this value.Methods inherited from class org.tquadrat.foundation.value.api.ValueBase
baseValue, copy, copy, equals, getUnit, hashCode, setUnit, toString
-
Field Details
-
TEMPERATURE_VALIDATOR
The validator for temperatures.
A temperature in Kelvin may not be less than 0.
-
-
Constructor Details
-
TemperatureValue
Creates a newTemperatureValue
instance.- Parameters:
dimension
- The dimension.value
- The value.
-
TemperatureValue
Creates a newTemperatureValue
instance.- Parameters:
dimension
- The dimension.value
- The value; it must be possible to parse the given String into aBigDecimal
.- Throws:
NumberFormatException
- The provided value cannot be converted into aBigDecimal
.
-
TemperatureValue
Creates a newLengthValue
instance.- Type Parameters:
N
- The type ofvalue
.- Parameters:
dimension
- The dimension.value
- The value.
-
-
Method Details
-
clone
Creates a new copy of this value.- Specified by:
clone
in interfaceDimensionedValue<Temperature>
- Overrides:
clone
in classValueBase<Temperature,
TemperatureValue> - Returns:
- The copy.
-