Bump versions to 10.0.0-SNAPSHOT
[mdsal.git] / model / ietf / rfc6991-ietf-inet-types / src / main / java / org / opendaylight / yang / gen / v1 / urn / ietf / params / xml / ns / yang / ietf / inet / types / rev130715 / IpAddressNoZoneBuilder.java
1 /*
2  * Copyright (c) 2015 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 package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
10
11 import java.util.regex.Pattern;
12
13 public class IpAddressNoZoneBuilder {
14
15     private static final Pattern IPV4_NO_ZONE_PATTERN =
16         Pattern.compile("[0-9\\.]*");
17     private static final Pattern IPV6_NO_ZONE_PATTERN1 =
18         Pattern.compile("[0-9a-fA-F:\\.]*");
19
20     public static IpAddressNoZone getDefaultInstance(final String defaultValue) {
21         if (IPV4_NO_ZONE_PATTERN.matcher(defaultValue).matches()) {
22             return new IpAddressNoZone((new Ipv4AddressNoZone(defaultValue)));
23         } else if (IPV6_NO_ZONE_PATTERN1.matcher(defaultValue).matches()) {
24             return new IpAddressNoZone((new Ipv6AddressNoZone(defaultValue)));
25         } else {
26             throw new IllegalArgumentException("Cannot create IpAddress from " + defaultValue);
27         }
28     }
29 }