0daf1643815bb005abe1ee791555181d96554404
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / serialization / match / AbstractUint16EntrySerializer.java
1 /*
2  * Copyright (c) 2019 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 package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
9
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
12 import org.opendaylight.yangtools.yang.common.Uint16;
13
14 public abstract class AbstractUint16EntrySerializer extends AbstractPrimitiveEntrySerializer<Uint16> {
15     protected AbstractUint16EntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
16         super(oxmClassCode, oxmFieldCode, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
17     }
18
19     @Override
20     protected final void serializeEntry(final Uint16 entry, final ByteBuf outBuffer) {
21         outBuffer.writeShort(entry.shortValue());
22     }
23 }