Merge changes Ie520cc6e,I5e764fe1
[bgpcep.git] / bgp / parser-spi / src / main / java / org / opendaylight / protocol / bgp / parser / spi / pojo / SimpleAddressFamilyRegistry.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.bgp.parser.spi.pojo;
9
10 import org.opendaylight.protocol.bgp.parser.spi.AddressFamilyRegistry;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
12
13 import com.google.common.base.Preconditions;
14
15 final class SimpleAddressFamilyRegistry extends AbstractFamilyRegistry<AddressFamily, Integer> implements AddressFamilyRegistry {
16         AutoCloseable registerAddressFamily(final Class<? extends AddressFamily> clazz, final int number) {
17                 Preconditions.checkArgument(number >= 0 && number <= 65535);
18                 return super.registerFamily(clazz, number);
19         }
20
21         @Override
22         public Class<? extends AddressFamily> classForFamily(final int number) {
23                 return super.classForFamily(number);
24         }
25
26         @Override
27         public Integer numberForClass(final Class<? extends AddressFamily> clazz) {
28                 return super.numberForClass(clazz);
29         }
30 }