Package org.onosproject.codec
Interface CodecService
-
public interface CodecServiceService 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(java.lang.Class<T> entityClass)Returns the JSON codec for the specified entity class.java.util.Set<java.lang.Class<?>>getCodecs()Returns the set of classes with currently registered codecs.<T> voidregisterCodec(java.lang.Class<T> entityClass, JsonCodec<T> codec)Registers the specified JSON codec for the given entity class.voidunregisterCodec(java.lang.Class<?> entityClass)Unregisters the JSON codec for the specified entity class.
-
-
-
Method Detail
-
getCodecs
java.util.Set<java.lang.Class<?>> getCodecs()
Returns the set of classes with currently registered codecs.- Returns:
- set of entity classes
-
getCodec
<T> JsonCodec<T> getCodec(java.lang.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(java.lang.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(java.lang.Class<?> entityClass)
Unregisters the JSON codec for the specified entity class.- Parameters:
entityClass- entity class
-
-