public class PortAnnotationConfig extends BaseConfig<ConnectPoint>
Config.FieldPresence
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CONFIG_KEY
"annotations" : a netcfg ConfigKey for
PortAnnotationConfig . |
Constructor and Description |
---|
PortAnnotationConfig()
Create a detached
PortAnnotationConfig . |
PortAnnotationConfig(ConnectPoint cp)
Create a detached
PortAnnotationConfig for specified port. |
Modifier and Type | Method and Description |
---|---|
PortAnnotationConfig |
annotation(java.lang.String key)
Remove configuration about specified key.
|
PortAnnotationConfig |
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 Port.
|
PortAnnotationConfig |
annotations(java.util.Map<java.lang.String,java.lang.String> replace)
Sets annotations to add to a Port.
|
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 java.lang.String CONFIG_KEY
PortAnnotationConfig
.public PortAnnotationConfig()
PortAnnotationConfig
.
Note: created instance needs to be initialized by #init(..) before using.
public PortAnnotationConfig(ConnectPoint cp)
PortAnnotationConfig
for specified port.
Note: created instance is not bound to NetworkConfigService,
thus cannot use Config.apply()
. Must be passed to the service
using NetworkConfigService#applyConfig
cp
- ConnectPointpublic 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.
isValid
in class Config<ConnectPoint>
public java.util.Map<java.lang.String,java.lang.String> annotations()
public PortAnnotationConfig 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 PortAnnotationConfig annotation(java.lang.String key, java.lang.String value)
key
- annotations keyvalue
- annotations value. specifying null removes the entry.public PortAnnotationConfig annotation(java.lang.String key)
key
- annotations key