Package org.onosproject.codec
Interface CodecService
-
public interface CodecService
Service for registering and retrieving JSON codecs for various entities.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> JsonCodec<T>
getCodec(Class<T> entityClass)
Returns the JSON codec for the specified entity class.Set<Class<?>>
getCodecs()
Returns the set of classes with currently registered codecs.<T> void
registerCodec(Class<T> entityClass, JsonCodec<T> codec)
Registers the specified JSON codec for the given entity class.void
unregisterCodec(Class<?> entityClass)
Unregisters the JSON codec for the specified entity class.
-
-
-
Method Detail
-
getCodecs
Set<Class<?>> getCodecs()
Returns the set of classes with currently registered codecs.- Returns:
- set of entity classes
-
getCodec
<T> JsonCodec<T> getCodec(Class<T> entityClass)
Returns the JSON codec for the specified entity class.- Type Parameters:
T
- entity type- Parameters:
entityClass
- entity class- Returns:
- JSON codec; null if no codec available for the class
-
registerCodec
<T> void registerCodec(Class<T> entityClass, JsonCodec<T> codec)
Registers the specified JSON codec for the given entity class.- Type Parameters:
T
- entity type- Parameters:
entityClass
- entity classcodec
- JSON codec
-
unregisterCodec
void unregisterCodec(Class<?> entityClass)
Unregisters the JSON codec for the specified entity class.- Parameters:
entityClass
- entity class
-
-