Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-api / src / main / java / org / opendaylight / openflowjava / protocol / api / extensibility / SerializerRegistry.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.openflowjava.protocol.api.extensibility;
9
10
11
12
13 /**
14  * Stores and handles serializers 
15  * @author michal.polkorab
16  *
17  */
18 public interface SerializerRegistry {
19
20     /**
21      * Serializer registry provisioning
22      */
23     public void init();
24
25     /**
26      * @param msgTypeKey lookup key
27      * @return serializer or NullPointerException if no serializer was found
28      */
29     <KEYTYPE, SERIALIZERTYPE extends OFGeneralSerializer> SERIALIZERTYPE 
30         getSerializer(MessageTypeKey<KEYTYPE> msgTypeKey);
31
32     /**
33      * Registers serializer
34      * Throws IllegalStateException when there is
35      * a serializer already registered under given key.
36      * 
37      * If the serializer implements {@link SerializerRegistryInjector} interface,
38      * the serializer is injected with SerializerRegistry instance.
39      * 
40      * @param key used for serializer lookup
41      * @param serializer serializer implementation
42      */
43     <KEYTYPE> void registerSerializer(MessageTypeKey<KEYTYPE> key,
44             OFGeneralSerializer serializer);
45
46     /**
47      * Unregisters serializer
48      * @param key used for serializer lookup
49      * @param serializer serializer implementation
50      * @return true if serializer was removed,
51      *  false if no serializer was found under specified key
52      */
53     <KEYTYPE> boolean unregisterSerializer(MessageTypeKey<KEYTYPE> key);
54 }