Class MeasurementValueConfiguration
-
- All Implemented Interfaces:
public class MeasurementValueConfiguration extends ScaleAndPrecision
Configures a measurement value and consists of a Scale, MeasurementPrecision, and a name for this configuration. These properties describe how the actual measurement value is calculated and formatted for the measurement annotations. The name property is just to have the option to display a user-friendly name in the UI, it has no further use. If we ever check for duplicates, or try to find a specific MeasurementValueConfiguration in the document's configuration list, only `scale` and `precision` matter. That being said, the combination of `scale` and `precision` needs to be unique - you cannot have two MeasurementValueConfigurations in the document with same scale and precision. The name can be null, in that case the UI shows generated name.
-
-
Constructor Summary
Constructors Constructor Description MeasurementValueConfiguration(String name, Scale scale, MeasurementPrecision precision)
Constructor.
-
Method Summary
Modifier and Type Method Description Scale
getScale()
MeasurementPrecision
getPrecision()
String
getName()
String
getNameForDisplay(boolean includePrecision)
String
getDefaultName(boolean includePrecision)
int
hashCode()
static MeasurementValueConfiguration
from(@NonNull() ScaleAndPrecision scaleAndPrecision)
static MeasurementValueConfiguration
defaultConfiguration()
boolean
equalsAll(@Nullable() Object other)
Also compares name as well as scale/precision. static void
setDefaultConfiguration(MeasurementValueConfiguration newDefault)
-
-
Constructor Detail
-
MeasurementValueConfiguration
MeasurementValueConfiguration(String name, Scale scale, MeasurementPrecision precision)
Constructor.- Parameters:
name
- Can be null - in which case we use a suitable stringified version of the scale.scale
- The scale for the measurements.precision
- How the value is rounded.
-
-
Method Detail
-
getPrecision
@NonNull() MeasurementPrecision getPrecision()
-
getNameForDisplay
String getNameForDisplay(boolean includePrecision)
-
getDefaultName
@NonNull() String getDefaultName(boolean includePrecision)
-
hashCode
int hashCode()
-
from
static MeasurementValueConfiguration from(@NonNull() ScaleAndPrecision scaleAndPrecision)
-
defaultConfiguration
static MeasurementValueConfiguration defaultConfiguration()
-
equalsAll
boolean equalsAll(@Nullable() Object other)
Also compares name as well as scale/precision. The standard comparison only checks what makes a unique MeasurementValueConfiguration which is Scale and MeasurementPrecision
-
setDefaultConfiguration
static void setDefaultConfiguration(MeasurementValueConfiguration newDefault)
-
-
-
-