Package org.onosproject.net.config
Class BaseConfig<S>
- java.lang.Object
-
- org.onosproject.net.config.Config<S>
-
- org.onosproject.net.config.BaseConfig<S>
-
- Type Parameters:
S
- type of subject
- All Implemented Interfaces:
CodecContext
- Direct Known Subclasses:
DeviceAnnotationConfig
,DeviceInjectionConfig
,HostAnnotationConfig
,PortAnnotationConfig
,ProtectionConfig
public abstract class BaseConfig<S> extends Config<S> implements CodecContext
Config
with access toCodecService
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.onosproject.net.config.Config
Config.FieldPresence
-
-
Constructor Summary
Constructors Constructor Description BaseConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> JsonCodec<T>
codec(java.lang.Class<T> entityClass)
Returns the JSON codec for the specified entity class.protected <T> T
decode(java.lang.String json, java.lang.Class<T> entityClass)
Decodes the specified entity from JSON using codec registered to this context.<T> T
getService(java.lang.Class<T> serviceClass)
Returns reference to the specified service implementation.com.fasterxml.jackson.databind.ObjectMapper
mapper()
Returns the JSON object mapper.-
Methods inherited from class org.onosproject.net.config.Config
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, isValid, isValidLength, key, node, setList, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, setOrClear, subject, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.onosproject.codec.CodecContext
decode, encode
-
-
-
-
Method Detail
-
codec
public <T> JsonCodec<T> codec(java.lang.Class<T> entityClass)
Description copied from interface:CodecContext
Returns the JSON codec for the specified entity class.- Specified by:
codec
in interfaceCodecContext
- Type Parameters:
T
- entity type- Parameters:
entityClass
- entity class- Returns:
- JSON codec; null if no codec available for the class
-
getService
public <T> T getService(java.lang.Class<T> serviceClass)
Description copied from interface:CodecContext
Returns reference to the specified service implementation.- Specified by:
getService
in interfaceCodecContext
- Type Parameters:
T
- service type- Parameters:
serviceClass
- service class- Returns:
- service implementation; null if no implementation available for the class
-
mapper
public com.fasterxml.jackson.databind.ObjectMapper mapper()
Description copied from interface:CodecContext
Returns the JSON object mapper.- Specified by:
mapper
in interfaceCodecContext
- Returns:
- object mapper
-
decode
protected <T> T decode(java.lang.String json, java.lang.Class<T> entityClass)
Decodes the specified entity from JSON using codec registered to this context.- Type Parameters:
T
- entity class type- Parameters:
json
- JSON String to decodeentityClass
- entity class- Returns:
- decoded entity
-
-