Javadoc update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / GetConfigReplyMessageFactory.java
1 /* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */
2 package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
3
4 import io.netty.buffer.ByteBuf;
5
6 import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
7 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag;
8 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutput;
9 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetConfigOutputBuilder;
10
11 /**
12  * Translates GetConfigReply messages
13  * @author michal.polkorab
14  * @author timotej.kubas
15  */
16 public class GetConfigReplyMessageFactory implements OFDeserializer<GetConfigOutput> {
17
18     private static GetConfigReplyMessageFactory instance;
19     
20     private GetConfigReplyMessageFactory() {
21         // singleton
22     }
23     
24     /**
25      * @return singleton factory
26      */
27     public static synchronized GetConfigReplyMessageFactory getInstance(){
28         if(instance == null){
29             instance = new GetConfigReplyMessageFactory();
30         }
31         return instance;
32     }
33
34     @Override
35     public GetConfigOutput bufferToMessage(ByteBuf rawMessage, short version) {
36         GetConfigOutputBuilder builder = new GetConfigOutputBuilder();
37         builder.setVersion(version);
38         builder.setXid(rawMessage.readUnsignedInt());
39         builder.setFlags(SwitchConfigFlag.forValue(rawMessage.readUnsignedShort()));
40         builder.setMissSendLen(rawMessage.readUnsignedShort());
41         return builder.build();
42     }
43 }