Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / util / TypeToClassInitHelper.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.impl.util;
9
10 import java.util.Map;
11
12 /**
13  * @author michal.polkorab
14  *
15  */
16 public class TypeToClassInitHelper {
17
18     private short version;
19     private Map<TypeToClassKey, Class<?>> messageClassMap;
20
21     /**
22      * Constructor
23      * @param version protocol wire version
24      * @param messageClassMap map which stores type to class mapping
25      */
26     public TypeToClassInitHelper(short version, Map<TypeToClassKey, 
27             Class<?>> messageClassMap) {
28         this.version = version;
29         this.messageClassMap = messageClassMap;
30     }
31
32     /**
33      * Registers Class int the type to class mapping
34      * @param type code value for message type / class
35      * @param clazz corresponding code -> class
36      */
37     public void registerTypeToClass(short type, Class<?> clazz) {
38         messageClassMap.put(new TypeToClassKey(version, type), clazz);
39     }
40 }