Class SimpleDatum
java.lang.Object
net.solarnetwork.domain.BasicIdentity<net.solarnetwork.domain.datum.DatumId>
net.solarnetwork.domain.datum.GeneralDatum
net.solarnetwork.node.domain.datum.SimpleDatum
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<net.solarnetwork.domain.datum.DatumId>,net.solarnetwork.domain.datum.Datum,net.solarnetwork.domain.datum.DatumSamplesContainer,net.solarnetwork.domain.datum.DatumSamplesOperations,net.solarnetwork.domain.datum.MutableDatum,net.solarnetwork.domain.datum.MutableDatumSamplesOperations,net.solarnetwork.domain.Differentiable<net.solarnetwork.domain.datum.DatumSamplesOperations>,net.solarnetwork.domain.Identity<net.solarnetwork.domain.datum.DatumId>,MutableNodeDatum,NodeDatum
- Direct Known Subclasses:
SimpleAtmosphericDatum,SimpleDayDatum,SimpleEnergyDatum,SimpleEnergyStorageDatum,SimpleNodeControlInfoDatum,SimplePriceDatum
public class SimpleDatum
extends net.solarnetwork.domain.datum.GeneralDatum
implements NodeDatum, MutableNodeDatum, Cloneable
Abstract base class for
NodeDatum implementations.- Since:
- 2.0
- Version:
- 1.0
- Author:
- matt
- See Also:
-
Field Summary
Fields inherited from interface net.solarnetwork.domain.datum.Datum
DATUM_TYPE_PROPERTY, DATUM_TYPES_PROPERTY, OP_STATE, OP_STATES, REVERSE_ACCUMULATING_SUFFIX_KEY, SOURCE_ID, TIMESTAMPFields inherited from interface net.solarnetwork.node.domain.datum.NodeDatum
TIMESTAMP_UPLOAD -
Constructor Summary
ConstructorsConstructorDescriptionSimpleDatum(net.solarnetwork.domain.datum.DatumId id, net.solarnetwork.domain.datum.DatumSamples samples) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()Public clone method.copyWithId(net.solarnetwork.domain.datum.DatumId id) Get a copy of this datum with a new IDcopyWithSamples(net.solarnetwork.domain.datum.DatumSamplesOperations samples) Create a copy of this instance with the sample properties replaced by a given samples instance.Get the date this object was uploaded to SolarNet.static SimpleDatumlocationDatum(Long locationId, String sourceId, Instant timestamp) Create a location datum.static SimpleDatumlocationDatum(Long locationId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples) Create a location datum.static SimpleDatumCreate a node datum.static SimpleDatumCreate a node datum.static SimpleDatumCreate a node datum.voidsetUploaded(Instant uploaded) Set the uploaded date.Methods inherited from class net.solarnetwork.domain.datum.GeneralDatum
addTag, asMutableSampleOperations, asSampleOperations, asSimpleMap, clear, createSimpleMap, datumTypes, findSampleValue, getKind, getObjectId, getSampleBigDecimal, getSampleData, getSampleData, getSampleDouble, getSampleFloat, getSampleInteger, getSampleLong, getSamples, getSampleString, getSampleValue, getSourceId, getTags, getTimestamp, hasSampleValue, hasSampleValue, hasTag, isEmpty, nodeDatum, putSampleValue, removeTag, setSampleData, setTags, toStringMethods inherited from class net.solarnetwork.domain.BasicIdentity
compareTo, equals, getId, hashCodeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface net.solarnetwork.domain.datum.Datum
asSampleOperations, asSimpleMap, getKind, getObjectId, getSampleData, getSourceId, getTimestampMethods inherited from interface net.solarnetwork.domain.datum.DatumSamplesOperations
differsFromMethods inherited from interface net.solarnetwork.domain.Identity
getId, hasIdMethods inherited from interface net.solarnetwork.domain.datum.MutableDatum
asMutableSampleOperationsMethods inherited from interface net.solarnetwork.domain.datum.MutableDatumSamplesOperations
copyFrom, mergeFrom, mergeFrom, removeTag
-
Constructor Details
-
SimpleDatum
public SimpleDatum(net.solarnetwork.domain.datum.DatumId id, net.solarnetwork.domain.datum.DatumSamples samples) Constructor.- Parameters:
id- the IDsamples- the samples; if null a new instance will be created
-
-
Method Details
-
nodeDatum
Create a node datum.The
nodeIdproperty will be set to null and presumed to be equal to the ID of the running node. Thetimestampwill be set to the system time. A newsamplesinstance will be created.- Parameters:
sourceId- the source ID- Returns:
- the new instance
-
nodeDatum
Create a node datum.The
nodeIdproperty will be set to null and presumed to be equal to the ID of the running node. A newsamplesinstance will be created.- Parameters:
sourceId- the source IDtimestamp- the timestamp- Returns:
- the new instance
-
nodeDatum
public static SimpleDatum nodeDatum(String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples) Create a node datum.The
nodeIdproperty will be set to null and presumed to be equal to the ID of the running node.- Parameters:
sourceId- the source IDtimestamp- the timestampsamples- the samples- Returns:
- the new instance
-
locationDatum
Create a location datum.A new
samplesinstance will be created.- Parameters:
locationId- the location IDsourceId- the source IDtimestamp- the timestamp- Returns:
- the new instance
-
locationDatum
public static SimpleDatum locationDatum(Long locationId, String sourceId, Instant timestamp, net.solarnetwork.domain.datum.DatumSamples samples) Create a location datum.- Parameters:
locationId- the location IDsourceId- the source IDtimestamp- the timestampsamples- the samples- Returns:
- the new instance
-
clone
Description copied from interface:NodeDatumPublic clone method.- Specified by:
clonein interfaceMutableNodeDatum- Specified by:
clonein interfaceNodeDatum- Overrides:
clonein classnet.solarnetwork.domain.datum.GeneralDatum- Returns:
- a copy of this instance
-
copyWithSamples
Description copied from interface:NodeDatumCreate a copy of this instance with the sample properties replaced by a given samples instance.- Specified by:
copyWithSamplesin interfacenet.solarnetwork.domain.datum.Datum- Specified by:
copyWithSamplesin interfaceNodeDatum- Overrides:
copyWithSamplesin classnet.solarnetwork.domain.datum.GeneralDatum- Parameters:
samples- the samples to use for the copy- Returns:
- a new copy of this instance
-
copyWithId
Description copied from interface:NodeDatumGet a copy of this datum with a new ID- Specified by:
copyWithIdin interfacenet.solarnetwork.domain.datum.Datum- Specified by:
copyWithIdin interfaceNodeDatum- Overrides:
copyWithIdin classnet.solarnetwork.domain.datum.GeneralDatum- Returns:
- the copy with the given ID
-
getUploaded
Description copied from interface:NodeDatumGet the date this object was uploaded to SolarNet.- Specified by:
getUploadedin interfaceNodeDatum- Returns:
- the upload date
-
setUploaded
Set the uploaded date.- Parameters:
uploaded- the date to set
-