Class BooleanData
java.lang.Object
org.osgi.service.dal.FunctionData
org.osgi.service.dal.functions.data.BooleanData
- All Implemented Interfaces:
Comparable<Object>
Function boolean data wrapper. It can contain a boolean value, timestamp and
additional metadata. It doesn't support measurement unit.
- See Also:
-
Field Summary
Fields inherited from class org.osgi.service.dal.FunctionData
DESCRIPTION, FIELD_METADATA, FIELD_TIMESTAMP
-
Constructor Summary
ConstructorDescriptionBooleanData
(long timestamp, Map<String, ?> metadata, boolean value) Constructs newBooleanData
instance with the specified arguments.BooleanData
(Map<String, ?> fields) Constructs newBooleanData
instance with the specified field values. -
Method Summary
Modifier and TypeMethodDescriptionint
Compares thisBooleanData
instance with the given argument.boolean
TwoBooleanData
instances are equal if they contain equal metadata, timestamp and boolean value.boolean
getValue()
ReturnsBooleanData
value.int
hashCode()
Returns the hash code for thisBooleanData
object.toString()
Returns the string representation of this boolean data.Methods inherited from class org.osgi.service.dal.FunctionData
getMetadata, getTimestamp
-
Field Details
-
FIELD_VALUE
Represents the value field name. The field value is available withgetValue()
. The field type isboolean
. The constant can be used as a key toBooleanData(Map)
.- See Also:
-
-
Constructor Details
-
BooleanData
Constructs newBooleanData
instance 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: {"value"=Boolean(true)...}. That map will initialize theFIELD_VALUE
field withtrue
.FIELD_VALUE
- mandatory field. The value type must beBoolean
.- Parameters:
fields
- Contains the newBooleanData
instance field values.- Throws:
ClassCastException
- If the field value types are not expected.IllegalArgumentException
- If the value is missing.NullPointerException
- If the fields map isnull
.
-
BooleanData
Constructs newBooleanData
instance with the specified arguments.- Parameters:
timestamp
- The boolean data timestamp optional field.metadata
- The boolean data metadata optional field.value
- The boolean value mandatory field.
-
-
Method Details
-
getValue
public boolean getValue()ReturnsBooleanData
value.- Returns:
BooleanData
value.
-
equals
TwoBooleanData
instances are equal if they contain equal metadata, timestamp and boolean value.- Overrides:
equals
in classFunctionData
- Parameters:
o
- The object to compare this data.- Returns:
true
if this object is equivalent to the specified one.- See Also:
-
hashCode
public int hashCode()Returns the hash code for thisBooleanData
object. The hash code is a sum ofFunctionData.hashCode()
andBoolean.hashCode()
, whereBoolean.hashCode()
represents the boolean value hash code.- Overrides:
hashCode
in classFunctionData
- Returns:
- The hash code of this
BooleanData
object. - See Also:
-
compareTo
Compares thisBooleanData
instance with the given argument. If the argument is notBooleanData
, it throwsClassCastException
. Otherwise, this method returns:-1
if this instance field is less than a field of the specified argument.0
if all fields are equivalent.1
if this instance field is greater than a field of the specified argument.
- Specified by:
compareTo
in interfaceComparable<Object>
- Overrides:
compareTo
in classFunctionData
- Parameters:
o
-BooleanData
to be compared.- Returns:
-1
,0
or1
depending on the comparison rules.- Throws:
ClassCastException
- If the method argument is not of typeBooleanData
.- See Also:
-
toString
Returns the string representation of this boolean data.
-