2 * Copyright (c) 2016 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.eclipse.jdt.annotation.NonNull;
11 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
12 import org.opendaylight.yangtools.yang.binding.DataContainer;
13 import org.opendaylight.yangtools.yang.common.Uint8;
16 * Abstract factory class to support OF protocol version assigning and reading.
18 public abstract class VersionAssignableFactory<T extends DataContainer> implements OFDeserializer<T> {
19 private Uint8 version;
22 * Assigns the version.
24 * @param newVersion OpenFlow protocol version
26 public void assignVersion(final @NonNull Uint8 newVersion) {
27 if (version != null) {
28 throw new IllegalStateException("Version already assigned: " + version);
34 * Returns the OpenFlow protocol version.
36 protected final Uint8 getVersion() {