Class GeneralDatumMetadata
- All Implemented Interfaces:
Serializable,DatumMetadataOperations,MutableDatumMetadataOperations,Differentiable<DatumMetadataOperations>
- Version:
- 2.1
- Author:
- matt
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.GeneralDatumMetadata(Map<String, Object> info) Construct with values.Construct with values.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Remove all data values.booleangetInfo()Get a general information metadata map.getM()Shortcut forgetInfo().getPm()Shortcut forgetPropertyInfo().Get a map of property info maps.getPropertyInfo(String key) Get the property information metadata map for a given key.Get a set of all available property info keys.inthashCode()voidmerge(DatumMetadataOperations meta, boolean replace) Merge the values from another datum metadata instance into this one.metadataAtPath(String path) Get a metadata value at a given path.<T> TmetadataAtPath(String path, Class<T> clazz) Get a metadata value of a given type at a given path.static ObjectmetadataAtPath(String path, GeneralDatumMetadata meta) Get a metadata value at a given path.static <T> TmetadataAtPath(String path, GeneralDatumMetadata meta, Class<T> clazz) Get a metadata value of a given type at a given path.voidpopulate(KeyValuePair[] data) Populate metadata values based on a list ofKeyValuePairinstances.voidputInfoValue(String key, Object value) Put a value into or remove a value from theDatumMetadataOperations.getInfo()map, creating the map if it doesn't exist.voidputInfoValue(String property, String key, Object value) Put a value into or remove a value from theDatumMetadataOperations.getPropertyInfo(String)map, creating the map if it doesn't exist.voidSet the complete property info map for a given property key.voidSet the complete info metadata map.voidShortcut forsetInfo(Map).voidShortcut forsetPropertyInfo(Map).voidSet the property info.toString()Methods inherited from class net.solarnetwork.domain.datum.DatumSupport
addTag, getMapBigDecimal, getMapDouble, getMapFloat, getMapInteger, getMapLong, getMapString, getT, getTags, hasTag, removeTag, setT, setTagsMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.solarnetwork.domain.datum.DatumMetadataOperations
differsFrom, getInfo, getInfoBigDecimal, getInfoBigDecimal, getInfoBigInteger, getInfoBigInteger, getInfoDouble, getInfoDouble, getInfoFloat, getInfoFloat, getInfoInteger, getInfoInteger, getInfoKeys, getInfoLong, getInfoLong, getInfoNumber, getInfoNumber, getInfoShort, getInfoShort, getInfoString, getInfoString, getTags, hasInfo, hasInfo, hasMetadataAtPath, hasPropertyInfo, hasTag, isEmptyMethods inherited from interface net.solarnetwork.domain.datum.MutableDatumMetadataOperations
addTag, removeTag, setTags
-
Constructor Details
-
GeneralDatumMetadata
public GeneralDatumMetadata()Default constructor. -
GeneralDatumMetadata
Copy constructor.This constructor will copy all the top-level collections into new collection instances, but preserving all value instances.
- Parameters:
other- the metadata to copy
-
GeneralDatumMetadata
Construct with values.- Parameters:
info- the info data
-
GeneralDatumMetadata
Construct with values.- Parameters:
info- the info datapropertyInfo- the property info data
-
-
Method Details
-
populate
Populate metadata values based on a list ofKeyValuePairinstances.Each pair's key will be used as a general metadata key, unless it starts with a / character in which case a path is assumed. Values that can be coerced to number types will be.
- Parameters:
data- the data to populate
-
toString
-
clear
public void clear()Description copied from class:DatumSupportRemove all data values.- Specified by:
clearin interfaceMutableDatumMetadataOperations- Overrides:
clearin classDatumSupport
-
getPropertyInfoKeys
Description copied from interface:DatumMetadataOperationsGet a set of all available property info keys.- Specified by:
getPropertyInfoKeysin interfaceDatumMetadataOperations- Returns:
- the set of property info keys, never null
-
getPropertyInfo
Description copied from interface:DatumMetadataOperationsGet the property information metadata map for a given key.- Specified by:
getPropertyInfoin interfaceDatumMetadataOperations- Parameters:
key- the property key to get the metadata for- Returns:
- the property metadata, or null
-
merge
Description copied from interface:MutableDatumMetadataOperationsMerge the values from another datum metadata instance into this one.- Specified by:
mergein interfaceMutableDatumMetadataOperations- Parameters:
meta- the metadata to merge into this objectreplace- if true then replace values in this object with equivalent ones in the provided object, otherwise keep the values from this object
-
putInfoValue
Description copied from interface:MutableDatumMetadataOperationsPut a value into or remove a value from theDatumMetadataOperations.getInfo()map, creating the map if it doesn't exist.- Specified by:
putInfoValuein interfaceMutableDatumMetadataOperations- Parameters:
key- the key to putvalue- the value to put, or null to remove the key
-
hashCode
public int hashCode() -
equals
-
getInfo
Description copied from interface:DatumMetadataOperationsGet a general information metadata map.- Specified by:
getInfoin interfaceDatumMetadataOperations- Returns:
- the map of general information, or null
-
setInfo
Description copied from interface:MutableDatumMetadataOperationsSet the complete info metadata map.- Specified by:
setInfoin interfaceMutableDatumMetadataOperations- Parameters:
info- the info to set, or null
-
getM
Shortcut forgetInfo().- Returns:
- map
-
setM
Shortcut forsetInfo(Map).- Parameters:
map- the Map to set
-
getPropertyInfo
Get a map of property info maps. Each top-level key represents a property name and the associated map the metadata for that property.- Returns:
- map
-
setInfo
Description copied from interface:MutableDatumMetadataOperationsSet the complete property info map for a given property key.- Specified by:
setInfoin interfaceMutableDatumMetadataOperations- Parameters:
key- the property keyinfo- the info metadata to set, or null
-
setPropertyInfo
Set the property info.- Parameters:
propertyInfo- the property info to set
-
getPm
Shortcut forgetPropertyInfo().- Returns:
- the map
-
setPm
Shortcut forsetPropertyInfo(Map).- Parameters:
map- the map to set
-
putInfoValue
Description copied from interface:MutableDatumMetadataOperationsPut a value into or remove a value from theDatumMetadataOperations.getPropertyInfo(String)map, creating the map if it doesn't exist.- Specified by:
putInfoValuein interfaceMutableDatumMetadataOperations- Parameters:
property- the property namekey- the key to putvalue- the value to put, or null to remove the key
-
metadataAtPath
Description copied from interface:DatumMetadataOperationsGet a metadata value at a given path.- Specified by:
metadataAtPathin interfaceDatumMetadataOperations- Parameters:
path- the path of the metadata object to get- Returns:
- the metadata value, or null if none exists at the given path
- See Also:
-
metadataAtPath
Description copied from interface:DatumMetadataOperationsGet a metadata value of a given type at a given path.The
pathsyntax is that of URL paths, using a / delimiter between nested metadata objects. The top-level path component must be one of /m forDatumMetadataOperations.getInfo()data, /pm forDatumMetadataOperations.getPropertyInfo(String)data, or /t forDatumMetadataOperations.getTags()data.For example, the path /m/foo would return the value associated with the "foo" key in the
Mapreturned fromDatumMetadataOperations.getInfo(). The path /pm/foo/bar would return the "bar" key in theMapassociated with the "foo" key in theMapreturned fromDatumMetadataOperations.getPropertyInfo(String).For tags, using the /t path will return the complete
Setof tags returned byDatumMetadataOperations.getTags(). If the path has another component, then the next component value will be returned if a tag matching that component value exists. For example the path /t/foo would return foo ifDatumMetadataOperations.getTags()contains foo, otherwise null.- Specified by:
metadataAtPathin interfaceDatumMetadataOperations- Type Parameters:
T- the expected return type- Parameters:
path- the path of the metadata object to getclazz- the expected class of the return type- Returns:
- the metadata, or null if none exists at the given path
or is not of type
T
-
metadataAtPath
Get a metadata value at a given path.The
pathsyntax is that of URL paths, using a / delimiter between nested metadata objects. The top-level path component must be one of /m forgetInfo()data, /pm forgetPropertyInfo()data, or /t forDatumSupport.getTags()data.For example, the path /m/foo would return the value associated with the "foo" key in the
Mapreturned fromgetInfo(). The path /pm/foo/bar would return the "bar" key in theMapassociated with the "foo" key in theMapreturned fromgetPropertyInfo().For tags, using the /t path will return the complete
Setof tags returned byDatumSupport.getTags(). If the path has another component, then the next component value will be returned if a tag matching that component value exists. For example the path /t/foo would return foo ifDatumSupport.getTags()contains foo, otherwise null.- Parameters:
path- the path of the metadata object to getmeta- the metadata to look in- Returns:
- the metadata value, or null if none exists at the given path
- Since:
- 1.3
-
metadataAtPath
Get a metadata value of a given type at a given path.- Type Parameters:
T- the expected return type- Parameters:
path- the path of the metadata object to getmeta- the metadata to look inclazz- the expected class of the return type- Returns:
- the metadata, or null if none exists at the given path
or is not of type
T - Since:
- 1.3
- See Also:
-