Refactor AbstractOxmMatchEntryDeserializer
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / match / OxmIcmpv4CodeDeserializer.java
1 /*
2  * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
9
10 import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
11
12 import io.netty.buffer.ByteBuf;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv4Code;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4CodeCaseBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv4.code._case.Icmpv4CodeBuilder;
17
18 /**
19  * Translates OxmIcmpv4Code messages.
20  *
21  * @author michal.polkorab
22  */
23 public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer {
24     public OxmIcmpv4CodeDeserializer() {
25         super(Icmpv4Code.class);
26     }
27
28     @Override
29     protected void deserialize(final ByteBuf input, final MatchEntryBuilder builder) {
30         builder.setMatchEntryValue(new Icmpv4CodeCaseBuilder()
31             .setIcmpv4Code(new Icmpv4CodeBuilder().setIcmpv4Code(readUint8(input)).build())
32             .build());
33     }
34 }