2 * Copyright (c) 2018 Pantheon Technologies, s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204;
10 import static com.google.common.base.Verify.verify;
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;
18 * Builder for {@link IpMulticastGroupAddress} instances.
20 * @author Robert Varga
24 public final class IpMulticastGroupAddressBuilder {
25 private static final Pattern IPV4_PATTERN;
28 verify(Ipv4Address.PATTERN_CONSTANTS.size() == 1);
29 IPV4_PATTERN = Pattern.compile(Ipv4MulticastGroupAddress.PATTERN_CONSTANTS.get(0));
32 private IpMulticastGroupAddressBuilder() {
33 //Exists only to defeat instantiation.
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));