package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
-/**
- */
public class IpAddressNoZoneBuilder {
private static final Pattern IPV4_NO_ZONE_PATTERN =
private static final Pattern IPV6_NO_ZONE_PATTERN1 =
Pattern.compile("[0-9a-fA-F:\\.]*");
-
public static IpAddressNoZone getDefaultInstance(final String defaultValue) {
- final Matcher ipv4NoZoneMatcher = IPV4_NO_ZONE_PATTERN.matcher(defaultValue);
-
- if (ipv4NoZoneMatcher.matches()) {
- if (IPV6_NO_ZONE_PATTERN1.matcher(defaultValue).matches()) {
- throw new IllegalArgumentException(
- String.format("Cannot create IpNoZoneAddress from \"%s\", matches both %s and %s",
- defaultValue, Ipv4AddressNoZone.class.getSimpleName(), Ipv6AddressNoZone.class.getSimpleName()));
-
- }
+ if (IPV4_NO_ZONE_PATTERN.matcher(defaultValue).matches()) {
return new IpAddressNoZone((new Ipv4AddressNoZone(defaultValue)));
} else if (IPV6_NO_ZONE_PATTERN1.matcher(defaultValue).matches()) {
return new IpAddressNoZone((new Ipv6AddressNoZone(defaultValue)));
throw new IllegalArgumentException("Cannot create IpAddress from " + defaultValue);
}
}
-
-}
+}
\ No newline at end of file