private static SimpleAddress tryIpPrefix(String defaultValue) { try { SimpleAddress address = new SimpleAddress(IpPrefixBuilder.getDefaultInstance(defaultValue)); return address; } catch (IllegalArgumentException e) { return null; } }
/** * Constructor provided only for using in JMX. Don't use it for * construction new object of this union type. */ @ConstructorProperties("value") public IpPrefix(char[] _value) { java.lang.String defVal = new java.lang.String(_value); IpPrefix defInst = IpPrefixBuilder.getDefaultInstance(defVal); this._ipv4Prefix = defInst._ipv4Prefix; this._ipv6Prefix = defInst._ipv6Prefix; this._value = _value == null ? null : _value.clone(); } /**
/** * Constructor provided only for using in JMX. Don't use it for * construction new object of this union type. */ @ConstructorProperties("value") public IpPrefix(char[] _value) { java.lang.String defVal = new java.lang.String(_value); IpPrefix defInst = IpPrefixBuilder.getDefaultInstance(defVal); this._ipv4Prefix = defInst._ipv4Prefix; this._ipv6Prefix = defInst._ipv6Prefix; this._value = _value == null ? null : _value.clone(); } /**
public static IpPrefixOrAddress getDefaultInstance(String defaultValue) { try { IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(defaultValue); return new IpPrefixOrAddress(ipPrefix); } catch (IllegalArgumentException e) { LOG.debug("{} is not of IpPrefix type; checking whether it's a IpAddress type", defaultValue); IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue); return new IpPrefixOrAddress(ipAddress); } } }
final IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(subnet.getCidr()); subnetBuilder.setCidr(ipPrefix);