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;
10 import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
11 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
12 import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
16 * @author michal.polkorab
18 public class InstructionSerializerRegistryHelper {
20 private short version;
21 private SerializerRegistry serializerRegistry;
24 * @param version Openflow wire version
25 * @param serializerRegistry
27 public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
28 this.version = version;
29 this.serializerRegistry = serializerRegistry;
33 * Registers given serializer
34 * @param instructionType
37 public <TYPE extends InstructionBase> void registerSerializer(Class<TYPE> instructionType,
38 OFGeneralSerializer serializer) {
39 serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,
40 instructionType, null), serializer);