blob: c6dbda20a8e4503f184d7616582718dbc417aa9c [file] [log] [blame]
Thomas Vachuskad404c512014-10-23 14:19:46 -07001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.onlab.onos.codec;
20
21import java.util.Set;
22
23/**
24 * Service for registering and retrieving JSON codecs for various entities.
25 */
26public interface CodecService {
27
28 /**
29 * Returns the set of classes with currently registered codecs.
30 *
31 * @return set of entity classes
32 */
33 Set<Class<?>> getCodecs();
34
35 /**
36 * Returns the JSON codec for the specified entity class.
37 *
38 * @param entityClass entity class
39 * @return JSON codec; null if no codec available for the class
40 */
41 JsonCodec getCodec(Class<?> entityClass);
42
43 /**
44 * Registers the specified JSON codec for the given entity class.
45 *
46 * @param entityClass entity class
47 * @param codec JSON codec
48 */
49 void registerCodec(Class<?> entityClass, JsonCodec codec);
50
51 /**
52 * Unregisters the JSON codec for the specified entity class.
53 *
54 * @param entityClass entity class
55 */
56 void unregisterCodec(Class<?> entityClass);
57
58}