List of usage examples for com.google.common.primitives UnsignedInts parseUnsignedInt
public static int parseUnsignedInt(String s)
From source file:org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.TagTypeBuilder.java
public static TagType getDefaultInstance(final java.lang.String defaultValue) { try {/* w w w. j a va2 s . com*/ final long parseUnsignedInt = UnsignedInts.parseUnsignedInt(defaultValue); return new TagType(parseUnsignedInt); } catch (final NumberFormatException e) { return new TagType(new HexString(defaultValue)); } }
From source file:org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.BgpStdCommunityTypeBuilder.java
public static BgpStdCommunityType getDefaultInstance(final java.lang.String defaultValue) { final Matcher commMatcher = COMM_TYPE_PATTERN.matcher(defaultValue); if (commMatcher.matches()) { return new BgpStdCommunityType(defaultValue); } else {/* w w w. j a v a 2s. c om*/ try { final long parseUnsignedInt = UnsignedInts.parseUnsignedInt(defaultValue); return new BgpStdCommunityType(parseUnsignedInt); } catch (final NumberFormatException e) { throw new IllegalArgumentException("Cannot create BgpStdCommunityType from " + defaultValue); } } }
From source file:org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.policy.rev151009.BgpSetMedTypeBuilder.java
public static BgpSetMedType getDefaultInstance(final java.lang.String defaultValue) { final Matcher ipv4Matcher = MED_TYPE_STRING_PATTERN.matcher(defaultValue); if (ipv4Matcher.matches()) { return new BgpSetMedType(defaultValue); } else {// ww w. java2 s . c o m try { final long parseUnsignedInt = UnsignedInts.parseUnsignedInt(defaultValue); return new BgpSetMedType(parseUnsignedInt); } catch (final NumberFormatException e) { try { final Enumeration medTypeEnum = BgpSetMedType.Enumeration.valueOf(defaultValue.toUpperCase()); return new BgpSetMedType(medTypeEnum); } catch (final IllegalArgumentException e1) { throw new IllegalArgumentException("Cannot create BgpSetMedType from " + defaultValue); } } } }
From source file:org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.RrClusterIdTypeBuilder.java
public static RrClusterIdType getDefaultInstance(final java.lang.String defaultValue) { final Matcher ipv4Matcher = IPV4_PATTERN.matcher(defaultValue); if (ipv4Matcher.matches()) { return new RrClusterIdType(new Ipv4Address(defaultValue)); } else {//from w ww. j av a 2 s . c om try { final long parseUnsignedInt = UnsignedInts.parseUnsignedInt(defaultValue); return new RrClusterIdType(parseUnsignedInt); } catch (final NumberFormatException e) { throw new IllegalArgumentException("Cannot create RrClusterIdType from " + defaultValue); } } }