Fixed some java8 non-compliant javadocs.
[bgpcep.git] / pcep / ietf-stateful02 / src / main / java / org / opendaylight / protocol / pcep / ietf / stateful02 / Stateful02LspaObjectParser.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. 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.protocol.pcep.ietf.stateful02;
9
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.protocol.pcep.impl.object.PCEPLspaObjectParser;
12 import org.opendaylight.protocol.pcep.spi.TlvRegistry;
13 import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Tlvs2;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated._00.rev140113.Tlvs2Builder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.stateful._02.rev140110.symbolic.path.name.tlv.SymbolicPathName;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.Tlvs;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.TlvsBuilder;
20
21 /**
22  * Parser for LSPA object
23  */
24 @Deprecated
25 public class Stateful02LspaObjectParser extends PCEPLspaObjectParser {
26
27     public Stateful02LspaObjectParser(final TlvRegistry tlvReg, final VendorInformationTlvRegistry viTlvReg) {
28         super(tlvReg, viTlvReg);
29     }
30
31     @Override
32     public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
33         super.addTlv(tbuilder, tlv);
34         final Tlvs2Builder nameBuilder = new Tlvs2Builder();
35         if (tbuilder.getAugmentation(Tlvs2.class) != null) {
36             final Tlvs2 t = tbuilder.getAugmentation(Tlvs2.class);
37             if (t.getSymbolicPathName() != null) {
38                 nameBuilder.setSymbolicPathName(t.getSymbolicPathName());
39             }
40         }
41         if (tlv instanceof SymbolicPathName) {
42             nameBuilder.setSymbolicPathName((SymbolicPathName) tlv);
43         }
44         tbuilder.addAugmentation(Tlvs2.class, nameBuilder.build());
45     }
46
47     @Override
48     public void serializeTlvs(final Tlvs tlvs, final ByteBuf body) {
49         if (tlvs == null) {
50             return;
51         }
52         super.serializeTlvs(tlvs, body);
53         if (tlvs.getAugmentation(Tlvs2.class) != null) {
54             final Tlvs2 nameTlvs = tlvs.getAugmentation(Tlvs2.class);
55             if (nameTlvs.getSymbolicPathName() != null) {
56                 serializeTlv(nameTlvs.getSymbolicPathName(), body);
57             }
58         }
59     }
60 }