Bump versions to 10.0.0-SNAPSHOT
[mdsal.git] / model / ietf / rfc8294-ietf-routing-types / src / main / java / org / opendaylight / yang / gen / v1 / urn / ietf / params / xml / ns / yang / ietf / routing / types / rev171204 / IpMulticastGroupAddressBuilder.java
1 /*
2  * Copyright (c) 2018 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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204;
9
10 import static com.google.common.base.Verify.verify;
11
12 import com.google.common.annotations.Beta;
13 import java.util.regex.Pattern;
14 import org.eclipse.jdt.annotation.NonNullByDefault;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
16
17 /**
18  * Builder for {@link IpMulticastGroupAddress} instances.
19  *
20  * @author Robert Varga
21  */
22 @Beta
23 @NonNullByDefault
24 public final class IpMulticastGroupAddressBuilder {
25     private static final Pattern IPV4_PATTERN;
26
27     static {
28         verify(Ipv4Address.PATTERN_CONSTANTS.size() == 1);
29         IPV4_PATTERN = Pattern.compile(Ipv4MulticastGroupAddress.PATTERN_CONSTANTS.get(0));
30     }
31
32     private IpMulticastGroupAddressBuilder() {
33         //Exists only to defeat instantiation.
34     }
35
36     public static IpMulticastGroupAddress getDefaultInstance(final String defaultValue) {
37         return IPV4_PATTERN.matcher(defaultValue).matches()
38                 ? new IpMulticastGroupAddress(new Ipv4MulticastGroupAddress(defaultValue))
39                         : new IpMulticastGroupAddress(new Ipv6MulticastGroupAddress(defaultValue));
40     }
41 }