@Override protected String ipv6PrefixString(final Ipv6Prefix prefix) { return prefix.getValue(); }
/** * Create ipv6 prefix from ipv6 address, by appending /128 mask * * @param ipv6AddressString the ip address, in string format * @return Ipv6Prefix with ipv6Address and /128 mask */ public static Ipv6Prefix iPv6PrefixFromIPv6Address(String ipv6AddressString) { return new Ipv6Prefix(ipv6AddressString + "/128"); }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Ipv6LocalAddressKey other = (Ipv6LocalAddressKey) obj; if (_ipv6Prefix == null) { if (other._ipv6Prefix != null) { return false; } } else if(!_ipv6Prefix.equals(other._ipv6Prefix)) { return false; } return true; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_ipv6Prefix == null) ? 0 : _ipv6Prefix.hashCode()); return result; }
@ConstructorProperties("value") public Ipv6Prefix(java.lang.String _value) { if (_value != null) { check_valueLength(_value); } Preconditions.checkNotNull(_value, "Supplied value may not be null"); for (Pattern p : patterns) { Preconditions.checkArgument(p.matcher(_value).matches(), "Supplied value \"%s\" does not match required pattern \"%s\"", _value, p); } this._value = _value; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_ipv6Prefix == null) ? 0 : _ipv6Prefix.hashCode()); return result; }
public IpPrefix(Ipv6Prefix _ipv6Prefix) { super(); this._ipv6Prefix = _ipv6Prefix; this._ipv4Prefix = null; this._value = _ipv6Prefix.getValue().toString().toCharArray(); }
public static Ipv6Prefix getDefaultInstance(String defaultValue) { return new Ipv6Prefix(defaultValue); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_ipv6Address == null) ? 0 : _ipv6Address.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); return result; }
@Override public boolean equals(java.lang.Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Ipv6LocalAddressKey other = (Ipv6LocalAddressKey) obj; if (_ipv6Prefix == null) { if (other._ipv6Prefix != null) { return false; } } else if(!_ipv6Prefix.equals(other._ipv6Prefix)) { return false; } return true; }
private static InetAddress inetAddressFrom(Ipv6Prefix source) { if (source != null) { String[] parts = source.getValue().split("/"); return InetAddresses.forString(parts[0]); } return null; }
public static Ipv6Prefix getDefaultInstance(String defaultValue) { return new Ipv6Prefix(defaultValue); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_ipv4Prefix == null) ? 0 : _ipv4Prefix.hashCode()); result = prime * result + ((_ipv6Prefix == null) ? 0 : _ipv6Prefix.hashCode()); result = prime * result + ((_value == null) ? 0 : Arrays.hashCode(_value)); return result; }
return false; } else if(!_ipv6Prefix.equals(other._ipv6Prefix)) { return false;
public char[] getValue() { if (_value == null) { if (_ipv4Prefix != null) { _value = _ipv4Prefix.getValue().toString().toCharArray(); } else if (_ipv6Prefix != null) { _value = _ipv6Prefix.getValue().toString().toCharArray(); } } return _value == null ? null : _value.clone(); }
public static IpPrefix getDefaultInstance(final String defaultValue) { final Matcher ipv4Matcher = IPV4_PATTERN.matcher(defaultValue); if (ipv4Matcher.matches()) { if (IPV6_PATTERN1.matcher(defaultValue).matches() && IPV6_PATTERN2.matcher(defaultValue).matches()) { throw new IllegalArgumentException( String.format("Cannot create IpPrefix from \"%s\", matches both %s and %s", defaultValue, Ipv4Address.class.getSimpleName(), Ipv6Address.class.getSimpleName())); } return new IpPrefix(new Ipv4Prefix(defaultValue)); } else if (IPV6_PATTERN1.matcher(defaultValue).matches() && IPV6_PATTERN2.matcher(defaultValue).matches()) { return new IpPrefix(new Ipv6Prefix(defaultValue)); } else { throw new IllegalArgumentException("Cannot create IpPrefix from " + defaultValue); } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_ipv6Destination == null) ? 0 : _ipv6Destination.hashCode()); result = prime * result + ((_ipv6ExtHeader == null) ? 0 : _ipv6ExtHeader.hashCode()); result = prime * result + ((_ipv6Label == null) ? 0 : _ipv6Label.hashCode()); result = prime * result + ((_ipv6NdSll == null) ? 0 : _ipv6NdSll.hashCode()); result = prime * result + ((_ipv6NdTarget == null) ? 0 : _ipv6NdTarget.hashCode()); result = prime * result + ((_ipv6NdTll == null) ? 0 : _ipv6NdTll.hashCode()); result = prime * result + ((_ipv6Source == null) ? 0 : _ipv6Source.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); return result; }
return false; } else if(!_ipv6Address.equals(other.getIpv6Address())) { return false;
public static String getStringIpPrefix(IpPrefix ipPrefix) { if (ipPrefix.getIpv4Prefix() != null) { return ipPrefix.getIpv4Prefix().getValue(); } return ipPrefix.getIpv6Prefix().getValue(); }
public static IpPrefix getDefaultInstance(final String defaultValue) { final Matcher ipv4Matcher = IPV4_PATTERN.matcher(defaultValue); if (ipv4Matcher.matches()) { if (IPV6_PATTERN1.matcher(defaultValue).matches() && IPV6_PATTERN2.matcher(defaultValue).matches()) { throw new IllegalArgumentException( String.format("Cannot create IpPrefix from \"%s\", matches both %s and %s", defaultValue, Ipv4Address.class.getSimpleName(), Ipv6Address.class.getSimpleName())); } return new IpPrefix(new Ipv4Prefix(defaultValue)); } else if (IPV6_PATTERN1.matcher(defaultValue).matches() && IPV6_PATTERN2.matcher(defaultValue).matches()) { return new IpPrefix(new Ipv6Prefix(defaultValue)); } else { throw new IllegalArgumentException("Cannot create IpPrefix from " + defaultValue); } }