Interface Datum
- All Known Subinterfaces:
AcDcEnergyDatum,AcEnergyDatum,AtmosphericDatum,DayDatum,DcEnergyDatum,EnergyDatum,EnergyStorageDatum,MutableDatum,PriceDatum
- All Known Implementing Classes:
GeneralDatum
- Version:
- 2.0
- Author:
- matt
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA property name for the string name of the core datum type a datum represents.static final StringA property name for an array of string names of all datum types associated with the event.static final StringA status sample key for aDeviceOperatingState.getCode()value.static final StringA status sample key for a bitmask of hardware-specific operating state values.static final StringA suffix to append to to data property keys that represent a logical reverse of the same key without this suffix.static final StringA sample data key for agetSourceId()value.static final StringA sample data key for agetTimestamp()value, as alongmillisecond epoch value or ISO 8601 formatted string. -
Method Summary
Modifier and TypeMethodDescriptionGet a general accessor for the sample data.Get a simpleMapview of this datum.copyWithId(DatumId id) Get a copy of this datum with a new ID.copyWithSamples(DatumSamplesOperations samples) Create a copy of this instance with the sample properties replaced by a given samples instance.getKind()Get the object kind.Get a domain-specific ID related to the object kind.Get a map of all available data sampled or collected on this datum.Get a unique source ID for this datum.Get the date this datum is associated with, which is often equal to either the date it was persisted or the date the associated data in this object was captured.
-
Field Details
-
REVERSE_ACCUMULATING_SUFFIX_KEY
A suffix to append to to data property keys that represent a logical reverse of the same key without this suffix. For example awattHoursReversekey might represent energy exported, rather than imported, through a power meter.- See Also:
-
DATUM_TYPE_PROPERTY
A property name for the string name of the core datum type a datum represents.The core data type is the most specific interface defined on a datum class, which will be the first value in the
DATUM_TYPES_PROPERTYproperty.- See Also:
-
DATUM_TYPES_PROPERTY
A property name for an array of string names of all datum types associated with the event.Datum types are the fully qualified interfaces defined on the datum implementation class, and any superclass. All Java language interfaces are ignored, e.g. packages starting with java. or javax. are not included. The array is ordered in reverse class hierarchy order.
- See Also:
-
OP_STATE
A status sample key for aDeviceOperatingState.getCode()value.- See Also:
-
OP_STATES
A status sample key for a bitmask of hardware-specific operating state values.- See Also:
-
TIMESTAMP
A sample data key for agetTimestamp()value, as alongmillisecond epoch value or ISO 8601 formatted string.- See Also:
-
SOURCE_ID
A sample data key for agetSourceId()value.- See Also:
-
-
Method Details
-
getKind
ObjectDatumKind getKind()Get the object kind.- Returns:
- the object kind
-
getObjectId
Long getObjectId()Get a domain-specific ID related to the object kind.- Returns:
- the object ID, or null
-
getTimestamp
Instant getTimestamp()Get the date this datum is associated with, which is often equal to either the date it was persisted or the date the associated data in this object was captured.- Returns:
- the timestamp
-
getSourceId
String getSourceId()Get a unique source ID for this datum.A single datum type may collect data from many different sources.
- Returns:
- the source ID
-
getSampleData
Get a map of all available data sampled or collected on this datum.- Returns:
- a map with all available sample data
-
asSimpleMap
Get a simpleMapview of this datum.The returned map should include all the available properties of this datum, in as flat of a structure as possible, i.e. without nested maps. The property values should be composed only if simple Java types like numbers, strings, and arrays or lists of those types. It should also include the
DATUM_TYPE_PROPERTYandDATUM_TYPES_PROPERTYvalues.- Returns:
- a Map view of this datum
-
asSampleOperations
DatumSamplesOperations asSampleOperations()Get a general accessor for the sample data.- Returns:
- the operations instance, never null
-
copyWithSamples
Create a copy of this instance with the sample properties replaced by a given samples instance.- Parameters:
samples- the samples to use for the copy- Returns:
- a new copy of this instance
-
copyWithId
Get a copy of this datum with a new ID.A new samples instance will also be created.
- Parameters:
id- the new ID to use- Returns:
- the copy with the given ID
-