@Test public final void testCreateIpAddress_ipv4() { String ipv4Address = "1.1.1.1"; IpAddress ipAddress = Utils.createIpAddress(ipv4Address); Assert.assertNotNull(ipAddress); Assert.assertNull(ipAddress.getIpv6Address()); assertEquals(ipv4Address, ipAddress.getIpv4Address().getValue()); }
public static IpAddress createIpAddress(String ipAddress) { checkArgument(!Strings.isNullOrEmpty(ipAddress), "Cannot be null or empty."); InetAddress ip = InetAddresses.forString(ipAddress); if (ip instanceof Inet4Address) { return new IpAddress(new Ipv4Address(ipAddress)); } return new IpAddress(new Ipv6Address(ipAddress)); }
Utils { public static IpAddress createIpAddress(String ipAddress) { checkArgument(!Strings.isNullOrEmpty(ipAddress), "Cannot be null or empty."); InetAddress ip = InetAddresses.forString(ipAddress); if (ip instanceof Inet4Address) { return new IpAddress(new Ipv4Address(ipAddress)); } return new IpAddress(new Ipv6Address(ipAddress)); } }
Utils { public static IpAddress createIpAddress(String ipAddress) { checkArgument(!Strings.isNullOrEmpty(ipAddress), "Cannot be null or empty."); InetAddress ip = InetAddresses.forString(ipAddress); if (ip instanceof Inet4Address) { return new IpAddress(new Ipv4Address(ipAddress)); } return new IpAddress(new Ipv6Address(ipAddress)); } private  Utils(); }
Utils { public static IpAddress createIpAddress(String ipAddress) { checkArgument(!Strings.isNullOrEmpty(ipAddress), "Cannot be null or empty."); InetAddress ip = InetAddresses.forString(ipAddress); if (ip instanceof Inet4Address) { return new IpAddress(new Ipv4Address(ipAddress)); } return new IpAddress(new Ipv6Address(ipAddress)); } private  Utils(); static IpPrefix createIpPrefix(String cidr); static IpAddress createIpAddress(String ipAddress); static String getStringIpPrefix(IpPrefix ipPrefix); static String getStringIpAddress(IpAddress ipAddress); static String normalizeUuid(String string); static void syncNat(ReadWriteTransaction rwTx, Floatingip oldFloatingIp, Floatingip newFloatingIp); static void removeNat(ReadWriteTransaction rwTx, Floatingip removedFloatingIp); }
Utils { public static IpAddress createIpAddress(String ipAddress) { checkArgument(!Strings.isNullOrEmpty(ipAddress), "Cannot be null or empty."); InetAddress ip = InetAddresses.forString(ipAddress); if (ip instanceof Inet4Address) { return new IpAddress(new Ipv4Address(ipAddress)); } return new IpAddress(new Ipv6Address(ipAddress)); } private  Utils(); static IpPrefix createIpPrefix(String cidr); static IpAddress createIpAddress(String ipAddress); static String getStringIpPrefix(IpPrefix ipPrefix); static String getStringIpAddress(IpAddress ipAddress); static String normalizeUuid(String string); static void syncNat(ReadWriteTransaction rwTx, Floatingip oldFloatingIp, Floatingip newFloatingIp); static void removeNat(ReadWriteTransaction rwTx, Floatingip removedFloatingIp);  }