Package org.osgi.service.dal
Interface PropertyMetadata
public interface PropertyMetadata
Contains metadata about a function property, a function operation parameter
or a function operation return value.
The access to the function properties is a bitmap value of
ACCESS
metadata key. Function properties can be accessed in three ways. Any
combinations between them are possible:
-
ACCESS_READABLE
- available for all properties, which can be read. Function must provide a getter method for an access to the property value. -
ACCESS_WRITABLE
- available for all properties, which can be modified. Function must provide a setter method for a modification of the property value. -
ACCESS_EVENTABLE
- available for all properties, which can report the property value.FunctionEvent
s are sent on property change.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Metadata key, which value represents the access to the function property.static final int
Marks the eventable function properties.static final int
Marks the readable function properties.static final int
Marks the writable function properties.static final String
Metadata key, which value represents the property description.static final String
Metadata key, which value represents the property supported units. -
Method Summary
Modifier and TypeMethodDescriptiongetEnumValues
(String unit) Returns the property possible values according to the specified unit.getMaxValue
(String unit) Returns the property maximum value according to the specified unit.getMetadata
(String unit) Returns metadata about the function property or operation parameter.getMinValue
(String unit) Returns the property minimum value according to the specified unit.Returns the difference between two values in series.
-
Field Details
-
ACCESS_READABLE
static final int ACCESS_READABLEMarks the readable function properties. The flag can be used as a part of bitmap value ofACCESS
. The readable access mandates function to provide a property getter method.- See Also:
-
ACCESS_WRITABLE
static final int ACCESS_WRITABLEMarks the writable function properties. The flag can be used as a part of bitmap value ofACCESS
. The writable access mandates function to provide a property setter methods.- See Also:
-
ACCESS_EVENTABLE
static final int ACCESS_EVENTABLEMarks the eventable function properties. The flag can be used as a part of bitmap value ofACCESS
.- See Also:
-
ACCESS
Metadata key, which value represents the access to the function property. The property value is a bitmap ofInteger
type. The bitmap can be any combination of: For example, valueInteger(3)
means that the property is readable and writable, but not eventable.The property access is available only for function properties and it's missing for the operation parameters.
- See Also:
-
DESCRIPTION
Metadata key, which value represents the property description. The property value type isjava.lang.String
.- See Also:
-
UNITS
Metadata key, which value represents the property supported units. The property value type isjava.lang.String[]
. The array first element at index0
represents the default unit. Each unit must follow those rules:- The International System of Units must be used where it's applicable. For example, kg for kilogram and km for kilometer.
- If the unit name matches to an Unicode symbol name, the Unicode
symbol must be used. For example, the degree unit matches to the Unicode
degree sign (
°
). - If the unit name doesn't match to an Unicode symbol, the unit symbol
must be built by Unicode Basic Latin block of characters, superscript and
subscript characters. For example, watt per square meter steradian is
built by
W/(m² sr)
.
SIUnits
interface.- See Also:
-
-
Method Details
-
getMetadata
Returns metadata about the function property or operation parameter. The keys of thejava.util.Map
result must be ofjava.lang.String
type. Possible keys:DESCRIPTION
- doesn't depend on the given unit.ACCESS
- available only for function property and missing for function operation parameters. It doesn't depend on the given unit.UNITS
- doesn't depend on the given unit.- custom key - can depend on the unit. Organizations that want to use custom keys that do not clash with OSGi Working Group defined should prefix their keys in own namespace.
- Parameters:
unit
- The unit to align the metadata if it's applicable. It can be null, which means that the default unit will be used.- Returns:
- The property metadata or
null
if no such metadata is available.
-
getStep
Returns the difference between two values in series. For example, if the range is [0, 100], the step can be 10.- Parameters:
unit
- The unit to align the step, can benull
.- Returns:
- The step according to the specified unit or
null
if no step is supported. - Throws:
IllegalArgumentException
- If the unit is not supported.
-
getEnumValues
Returns the property possible values according to the specified unit. If the unit isnull
, the values set is aligned to the default unit. If there is no such set of supported values,null
is returned. The values must be sorted in increasing order.- Parameters:
unit
- The unit to align the supported values, can benull
.- Returns:
- The supported values according to the specified unit or
null
if no such values are supported. The values must be sorted in increasing order. - Throws:
IllegalArgumentException
- If the unit is not supported.
-
getMinValue
Returns the property minimum value according to the specified unit. If the unit isnull
, the minimum value is aligned to the default unit. If there is no minimum value,null
is returned.- Parameters:
unit
- The unit to align the minimum value, can benull
.- Returns:
- The minimum value according to the specified unit or
null
if no minimum value is supported. - Throws:
IllegalArgumentException
- If the unit is not supported.
-
getMaxValue
Returns the property maximum value according to the specified unit. If the unit isnull
, the maximum value is aligned to the default unit. If there is no maximum value,null
is returned.- Parameters:
unit
- The unit to align the maximum value, can benull
.- Returns:
- The maximum value according to the specified unit or
null
if no maximum value is supported. - Throws:
IllegalArgumentException
- If the unit is not supported.
-