public class DeviceAnnotationConfig extends BaseConfig<DeviceId>
Config.FieldPresence| Modifier and Type | Field and Description |
|---|---|
static java.lang.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(java.lang.String key)
Remove configuration about specified key.
|
DeviceAnnotationConfig |
annotation(java.lang.String key,
java.lang.String value)
Add configuration to set or remove annotation entry.
|
java.util.Map<java.lang.String,java.lang.String> |
annotations()
Returns annotations to add to a Device.
|
DeviceAnnotationConfig |
annotations(java.util.Map<java.lang.String,java.lang.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, mapperapply, 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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdecode, encodepublic static final java.lang.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()
ConfigDefault 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 java.util.Map<java.lang.String,java.lang.String> annotations()
public DeviceAnnotationConfig annotations(java.util.Map<java.lang.String,java.lang.String> replace)
replace - annotations to be added by this configuration.
null value represent key removal requestpublic DeviceAnnotationConfig annotation(java.lang.String key, java.lang.String value)
key - annotations keyvalue - annotations value. specifying null removes the entry.public DeviceAnnotationConfig annotation(java.lang.String key)
key - annotations key