Class LevelData
java.lang.Object
org.osgi.service.dal.FunctionData
org.osgi.service.dal.functions.data.LevelData
- All Implemented Interfaces:
- Comparable<Object>
Function level data wrapper. It supports all properties defined in
 
FunctionData.- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringRepresents the level field name.static final StringRepresents the unit field name.Fields inherited from class org.osgi.service.dal.FunctionDataDESCRIPTION, FIELD_METADATA, FIELD_TIMESTAMP
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionintCompares thisLevelDatainstance with the given argument.booleanTwoLevelDatainstances are equal if they contain equal metadata, timestamp, unit and level.getLevel()ReturnsLevelDatavalue.getUnit()inthashCode()Returns the hash code for thisLevelDataobject.toString()Returns the string representation of this level data.Methods inherited from class org.osgi.service.dal.FunctionDatagetMetadata, getTimestamp
- 
Field Details- 
FIELD_LEVELRepresents the level field name. The field value is available withgetLevel(). The field type isBigDecimal. The constant can be used as a key toLevelData(Map).- See Also:
 
- 
FIELD_UNITRepresents the unit field name. The field value is available withgetUnit(). The field type isString. The constant can be used as a key toLevelData(Map).- See Also:
 
 
- 
- 
Constructor Details- 
LevelDataConstructs newLevelDatainstance with the specified field values. The map keys must match to the field names. The map values will be assigned to the appropriate class fields. For example, the maps can be: {"level"=BigDecimal(1)...}. That map will initialize theFIELD_LEVELfield with 1.- FIELD_LEVEL- mandatory field. The value type must be- BigDecimal.
- FIELD_UNIT- optional field. The value type must be- String.
 - Parameters:
- fields- Contains the new- LevelDatainstance field values.
- Throws:
- ClassCastException- If the field value types are not expected.
- IllegalArgumentException- If the level is missing.
- NullPointerException- If the fields map is- null.
 
- 
LevelDataConstructs newLevelDatainstance with the specified arguments.- Parameters:
- timestamp- The data timestamp optional field.
- metadata- The data metadata optional field.
- level- The level value mandatory field.
- unit- The data unit optional field.
- Throws:
- NullPointerException- If- levelis- null.
 
 
- 
- 
Method Details- 
getLevelReturnsLevelDatavalue. The value type isBigDecimalinstead ofdoubleto guarantee value accuracy.- Returns:
- The LevelDatavalue.
 
- 
getUnit- Returns:
- The value unit or nullif the unit is missing.
 
- 
equalsTwoLevelDatainstances are equal if they contain equal metadata, timestamp, unit and level.- Overrides:
- equalsin class- FunctionData
- Parameters:
- o- The object to compare this data.
- Returns:
- trueif this object is equivalent to the specified one.
- See Also:
 
- 
hashCodepublic int hashCode()Returns the hash code for thisLevelDataobject. The hash code is a sum ofFunctionData.hashCode(),String.hashCode()andBigDecimal.hashCode(), whereString.hashCode()represents the unit hash code andBigDecimal.hashCode()represents the level hash code.- Overrides:
- hashCodein class- FunctionData
- Returns:
- The hash code of this LevelDataobject.
- See Also:
 
- 
compareToCompares thisLevelDatainstance with the given argument. If the argument is notLevelData, it throwsClassCastException. Otherwise, this method returns:- -1if this instance field is less than a field of the specified argument.
- 0if all fields are equivalent.
- 1if this instance field is greater than a field of the specified argument.
 - Specified by:
- compareToin interface- Comparable<Object>
- Overrides:
- compareToin class- FunctionData
- Parameters:
- o-- LevelDatato be compared.
- Returns:
- -1,- 0or- 1depending on the comparison rules.
- Throws:
- ClassCastException- If the method argument is not of type- LevelData.
- See Also:
 
- 
toStringReturns the string representation of this level data.
 
-