2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowjava.protocol.impl.util;
11 import org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey;
14 * @author michal.polkorab
17 public class TypeToClassInitHelper {
19 private short version;
20 private Map<TypeToClassKey, Class<?>> messageClassMap;
24 * @param version protocol wire version
25 * @param messageClassMap map which stores type to class mapping
27 public TypeToClassInitHelper(short version, Map<TypeToClassKey,
28 Class<?>> messageClassMap) {
29 this.version = version;
30 this.messageClassMap = messageClassMap;
34 * Registers Class int the type to class mapping
35 * @param type code value for message type / class
36 * @param clazz class corresponding to the code
38 public void registerTypeToClass(short type, Class<?> clazz) {
39 messageClassMap.put(new TypeToClassKey(version, type), clazz);