All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.ocpjava.protocol.impl.util.CommonMessageRegistryHelper Maven / Gradle / Ivy

There is a newer version: 0.3.3
Show newest version
/*
 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
 * Copyright (c) 2015 Foxconn Corporation
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

package org.opendaylight.ocpjava.protocol.impl.util;

import org.opendaylight.ocpjava.protocol.api.extensibility.OCPGeneralSerializer;
import org.opendaylight.ocpjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.ocpjava.protocol.api.keys.MessageTypeKey;

/**
 * @author Marko Lai 
 *
 */
public class CommonMessageRegistryHelper {

    private short version;
    private SerializerRegistry serializerRegistry;

    /**
     * @param version
     * @param serializerRegistry
     */
    public CommonMessageRegistryHelper(short version, SerializerRegistry serializerRegistry) {
        this.version = version;
        this.serializerRegistry = serializerRegistry;
    }

    /**
     * @param msgType
     * @param serializer
     */
    public void registerSerializer(Class msgType, OCPGeneralSerializer serializer) {
        serializerRegistry.registerSerializer(new MessageTypeKey<>(version, msgType), serializer);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy