2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.openflowjava.protocol.impl.util;
\r
10 import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer;
\r
11 import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
\r
12 import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.InstructionBase;
\r
16 * @author michal.polkorab
\r
18 public class InstructionSerializerRegistryHelper {
\r
20 private short version;
\r
21 private SerializerRegistry serializerRegistry;
\r
24 * @param version Openflow wire version
\r
25 * @param serializerRegistry
\r
27 public InstructionSerializerRegistryHelper(short version, SerializerRegistry serializerRegistry) {
\r
28 this.version = version;
\r
29 this.serializerRegistry = serializerRegistry;
\r
33 * Registers given serializer
\r
34 * @param instructionType
\r
37 public <TYPE extends InstructionBase> void registerSerializer(Class<TYPE> instructionType,
\r
38 OFGeneralSerializer serializer) {
\r
39 serializerRegistry.registerSerializer(new InstructionSerializerKey<>(version,
\r
40 instructionType, null), serializer);
\r