Fix checkstyle violations in openflowjava-util
[openflowplugin.git] / openflowjava / openflowjava-util / src / main / java / org / opendaylight / openflowjava / util / ExperimenterSerializerKeyFactory.java
1 /*
2  * Copyright (c) 2014 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
9 package org.opendaylight.openflowjava.util;
10
11 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdMeterSubTypeSerializerKey;
12 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdSerializerKey;
13 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterIdTypeSerializerKey;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterMeterBandSubType;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.meter.band.header.meter.band.MeterBandExperimenterCase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
18
19 /**
20  * Factory for creating experimenter serializer keys.
21  *
22  * @author michal.polkorab
23  */
24 public abstract class ExperimenterSerializerKeyFactory {
25
26     /**
27      * Creates an experimenter message serializer key.
28      *
29      * @param msgVersion openflow wire version
30      * @param experimenterId experimenter / vendor ID
31      * @param type experimenter type according to vendor implementation
32      * @return key instance
33      */
34     public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createExperimenterMessageSerializerKey(
35             short msgVersion, long experimenterId, long type) {
36         return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
37     }
38
39     /**
40      * Creates a multi-part request serializer key.
41      *
42      * @param msgVersion openflow wire version
43      * @param experimenterId experimenter / vendor ID
44      * @param type experimenter type according to vendor implementation
45      * @return key instance
46      */
47     public static ExperimenterIdSerializerKey<ExperimenterDataOfChoice> createMultipartRequestSerializerKey(
48             short msgVersion, long experimenterId, long type) {
49         return new ExperimenterIdTypeSerializerKey<>(msgVersion, experimenterId, type, ExperimenterDataOfChoice.class);
50     }
51
52     /**
53      * Creates a multi-part request TF serializer key.
54      *
55      * @param msgVersion openflow wire version
56      * @param experimenterId experimenter / vendor ID
57      * @return key instance
58      */
59     public static ExperimenterIdSerializerKey<TableFeatureProperties> createMultipartRequestTFSerializerKey(
60             short msgVersion, long experimenterId) {
61         return new ExperimenterIdSerializerKey<>(msgVersion, experimenterId, TableFeatureProperties.class);
62     }
63
64     /**
65      * Creates a meter band serializer key.
66      *
67      * @param msgVersion openflow wire version
68      * @param experimenterId experimenter / vendor ID
69      * @return key instance
70      */
71     public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
72             short msgVersion, long experimenterId) {
73         return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId,
74                 MeterBandExperimenterCase.class, null);
75     }
76
77     public static ExperimenterIdSerializerKey<MeterBandExperimenterCase> createMeterBandSerializerKey(
78             short msgVersion, long experimenterId, Class<? extends ExperimenterMeterBandSubType> meterSubType) {
79         return new ExperimenterIdMeterSubTypeSerializerKey<>(msgVersion, experimenterId,
80                 MeterBandExperimenterCase.class, meterSubType);
81     }
82 }