77abcbd0a396a9a872a5e30e488047cde0754e75
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / controller / config / yang / bgp / rib / impl / BGPTableTypeImplModule.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 /**
9  * Generated file
10
11  * Generated from: yang module name: bgp-rib-impl  yang module local name: bgp-table-type-impl
12  * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13  * Generated at: Sat Jan 25 20:28:03 CET 2014
14  *
15  * Do not modify this file unless it is present under src/main directory
16  */
17 package org.opendaylight.controller.config.yang.bgp.rib.impl;
18
19 import static java.util.Objects.requireNonNull;
20
21 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
25 import org.opendaylight.yangtools.yang.binding.DataContainer;
26
27 /**
28  *
29  */
30 public final class BGPTableTypeImplModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractBGPTableTypeImplModule {
31
32     public BGPTableTypeImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
33             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
34         super(identifier, dependencyResolver);
35     }
36
37     public BGPTableTypeImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
38             final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BGPTableTypeImplModule oldModule,
39             final java.lang.AutoCloseable oldInstance) {
40
41         super(identifier, dependencyResolver, oldModule, oldInstance);
42     }
43
44     @Override
45     protected void customValidation() {
46         JmxAttributeValidationException.checkNotNull(getAfi(), "value is not set.", afiJmxAttribute);
47         JmxAttributeValidationException.checkNotNull(getSafi(), "value is not set.", safiJmxAttribute);
48     }
49
50     @Override
51     public java.lang.AutoCloseable createInstance() {
52         return new AutoCloseableBgpTableType(getAfiIdentity(), getSafiIdentity());
53     }
54
55     private static final class AutoCloseableBgpTableType implements AutoCloseable, BgpTableType {
56         private final Class<? extends AddressFamily> afi;
57         private final Class<? extends SubsequentAddressFamily> safi;
58
59         public AutoCloseableBgpTableType(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
60             this.afi = requireNonNull(afi);
61             this.safi = requireNonNull(safi);
62         }
63
64         @Override
65         public Class<? extends DataContainer> getImplementedInterface() {
66             return BgpTableType.class;
67         }
68
69         @Override
70         public Class<? extends AddressFamily> getAfi() {
71             return this.afi;
72         }
73
74         @Override
75         public Class<? extends SubsequentAddressFamily> getSafi() {
76             return this.safi;
77         }
78
79         @Override
80         public void close() {
81             // Nothing to do
82         }
83
84         @Override
85         public String toString() {
86             final StringBuilder builder = new StringBuilder();
87             builder.append("AutoCloseableBgpTableType [getAfi()=");
88             builder.append(getAfi());
89             builder.append(", getSafi()=");
90             builder.append(getSafi());
91             builder.append("]");
92             return builder.toString();
93         }
94     }
95 }