public class DeviceAnnotationConfig extends BaseConfig<DeviceId>
Config.FieldPresence
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_KEY
"annotations" : a netcfg ConfigKey for
DeviceAnnotationConfig . |
Constructor and Description |
---|
DeviceAnnotationConfig()
Create a detached
DeviceAnnotationConfig . |
DeviceAnnotationConfig(DeviceId deviceId)
Create a detached
DeviceAnnotationConfig for specified device. |
Modifier and Type | Method and Description |
---|---|
DeviceAnnotationConfig |
annotation(String key)
Remove configuration about specified key.
|
DeviceAnnotationConfig |
annotation(String key,
String value)
Add configuration to set or remove annotation entry.
|
Map<String,String> |
annotations()
Returns annotations to add to a Device.
|
DeviceAnnotationConfig |
annotations(Map<String,String> replace)
Sets annotations to add to a Device.
|
boolean |
isValid()
Indicates whether or not the backing JSON node contains valid data.
|
codec, decode, getService, mapper
apply, clear, get, get, get, get, get, get, getList, getList, hasField, hasField, hasFields, hasFields, hasOnlyFields, hasOnlyFields, init, isBoolean, isBoolean, isConnectPoint, isConnectPoint, isDecimal, isDecimal, isIntegralNumber, isIntegralNumber, isIpAddress, isIpAddress, isIpPrefix, isIpPrefix, isMacAddress, isMacAddress, isNumber, isNumber, isString, isString, isTpPort, isTpPort, isValidLength, key, node, setList, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, subject, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
decode, encode
public static final String CONFIG_KEY
DeviceAnnotationConfig
.public DeviceAnnotationConfig()
DeviceAnnotationConfig
.
Note: created instance needs to be initialized by #init(..) before using.
public DeviceAnnotationConfig(DeviceId deviceId)
DeviceAnnotationConfig
for specified device.
Note: created instance is not bound to NetworkConfigService,
thus cannot use Config.apply()
. Must be passed to the service
using NetworkConfigService#applyConfig
deviceId
- Device idpublic boolean isValid()
Config
Default implementation returns true. Subclasses are expected to override this with their own validation. Implementations are free to throw a RuntimeException if data is invalid.
public Map<String,String> annotations()
public DeviceAnnotationConfig annotations(Map<String,String> replace)
replace
- annotations to be added by this configuration.
null value represent key removal requestpublic DeviceAnnotationConfig annotation(String key, String value)
key
- annotations keyvalue
- annotations value. specifying null removes the entry.public DeviceAnnotationConfig annotation(String key)
key
- annotations key