Package org.onosproject.codec
Interface CodecContext
-
- All Known Implementing Classes:
AbstractInjectionResource
,AbstractShellCommand
,AbstractWebResource
,AddHostToHostIntentCommand
,AddMultiPointToSinglePointIntentCommand
,AddPointToPointIntentCommand
,AddProtectedTransportIntentCommand
,AddSinglePointToMultiPointIntentCommand
,AddTestFlowsCommand
,AllocationsCommand
,AnnotateDeviceCommand
,AnnotateHostCommand
,AnnotateLinkCommand
,AnnotatePortCommand
,ApplicationCommand
,ApplicationIdListCommand
,ApplicationsListCommand
,BalanceMastersCommand
,BaseConfig
,BitErrorCommand
,ClusterDevicesCommand
,ClusterLinksCommand
,ClustersListCommand
,ComponentConfigCommand
,ConfigureLinkCommand
,ConnectivityIntentCommand
,CounterCommand
,CountersListCommand
,DeviceAnnotationConfig
,DeviceControllersCommand
,DeviceDriversCommand
,DeviceInjectionConfig
,DeviceInterfaceAddCommand
,DeviceInterfaceRemoveCommand
,DeviceInterfacesListCommand
,DeviceKeyAddCommand
,DeviceKeyListCommand
,DeviceKeyRemoveCommand
,DevicePortsListCommand
,DevicePortsRemoveCommand
,DevicePortStateCommand
,DevicePortStatsCommand
,DeviceRebootCommand
,DeviceRemoveCommand
,DeviceRoleCommand
,DeviceSetControllersCommand
,DevicesListCommand
,DeviceTimeCommand
,DriverProvidersListCommand
,DriversListCommand
,EdgePortsListCommand
,FlowObjectiveCompositionCommand
,FlowObjectiveNextListCommand
,FlowObjectivePendingNextCommand
,FlowObjectiveQueueClearCommand
,FlowObjectiveQueueListCommand
,FlowsListCommand
,GetDomainsCommand
,GetFlowStatisticsCommand
,GetStatisticsCommand
,GroupsListCommand
,HostAnnotationConfig
,HostRemoveCommand
,HostsListCommand
,IntentCycleCommand
,IntentDetailsCommand
,IntentListCompilers
,IntentListInstallers
,IntentPurgeCommand
,IntentPushTestCommand
,IntentRemoveCommand
,IntentsDiagnosisCommand
,IntentsListCommand
,InterfaceAddCommand
,InterfaceRemoveCommand
,InterfacesListCommand
,InternalConnectivityCommand
,IssuCommand
,LayoutAddCommand
,LayoutListCommand
,LeaderCommand
,LinksListCommand
,MapsListCommand
,MarkCommand
,MastersListCommand
,McastDeleteCommand
,McastJoinCommand
,McastRoutesListCommand
,McastShowCommand
,MembershipsListCommand
,MeterAddCommand
,MeterRemoveCommand
,MetersListCommand
,MetricsListCommand
,NeighbourHandlersListCommand
,NetworkConfigCommand
,NetworkConfigRegistryCommand
,NodesListCommand
,PacketProcessorsListCommand
,PacketRequestsListCommand
,PartitionsListCommand
,PathListCommand
,PipeconfCommand
,PortAnnotationConfig
,PortQueryVlansCommand
,PowerConfigCommand
,PrettyJson
,PrettyXml
,ProtectionConfig
,QueuesListCommand
,RandomIntentCommand
,RegionAddCommand
,RegionAddDevicesCommand
,RegionAddPeerLocCommand
,RegionListCommand
,RegionRemoveCommand
,RegionRemoveDevicesCommand
,RegionUpdateCommand
,ResourcesCommand
,ReviewCommand
,RolesCommand
,ScrListCommand
,StorageNodesListCommand
,SummaryCommand
,TableStatisticsCommand
,TestAllocateResource
,TestProtectionEndpointIntentCommand
,TopologyCommand
,TransactionsCommand
,WipeOutCommand
public interface CodecContext
Context for codecs to use while encoding/decoding.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> JsonCodec<T>
codec(Class<T> entityClass)
Returns the JSON codec for the specified entity class.default <T> T
decode(com.fasterxml.jackson.databind.JsonNode json, Class<T> entityClass)
Decodes the specified entity from JSON using codec registered to this context.default <T> com.fasterxml.jackson.databind.node.ObjectNode
encode(T entity, Class<T> entityClass)
Encodes the specified entity into JSON using codec registered to this context.<T> T
getService(Class<T> serviceClass)
Returns reference to the specified service implementation.com.fasterxml.jackson.databind.ObjectMapper
mapper()
Returns the JSON object mapper.
-
-
-
Method Detail
-
mapper
com.fasterxml.jackson.databind.ObjectMapper mapper()
Returns the JSON object mapper.- Returns:
- object mapper
-
codec
<T> JsonCodec<T> codec(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
-
getService
<T> T getService(Class<T> serviceClass)
Returns reference to the specified service implementation.- Type Parameters:
T
- service type- Parameters:
serviceClass
- service class- Returns:
- service implementation; null if no implementation available for the class
-
decode
default <T> T decode(com.fasterxml.jackson.databind.JsonNode json, Class<T> entityClass)
Decodes the specified entity from JSON using codec registered to this context.- Type Parameters:
T
- entity type- Parameters:
json
- JSON to decodeentityClass
- entity class- Returns:
- decoded entity
-
encode
default <T> com.fasterxml.jackson.databind.node.ObjectNode encode(T entity, Class<T> entityClass)
Encodes the specified entity into JSON using codec registered to this context.- Type Parameters:
T
- entity type- Parameters:
entity
- entity to encodeentityClass
- entity class- Returns:
- JSON node
-
-