@Test public void testOfWithInvalidType() { thrown.expect(IllegalArgumentException.class); ExtendedCommunity.of(4 << 8, 1, 1); }
public static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator) { checkArgument( type >= 0 && type <= 0xFFFF, "Extended community type %s is not within the allowed range", type); byte typeByte = (byte) (type >> 8); checkArgument( _validTypes.contains(typeByte), "Not a valid BGP extended community type: %s", type); checkArgument( globalAdministrator >= 0 && localAdministrator >= 0, "Administrator values must be positive"); if (typeByte == 0x00 || typeByte == 0x40) { checkArgument( globalAdministrator <= 0xFFFFL && localAdministrator <= 0xFFFFFFFFL, "Extended community administrator values are not within the allowed range"); } else { checkArgument( globalAdministrator <= 0xFFFFFFFFL && localAdministrator <= 0xFFFFL, "Extended community administrator values are not within the allowed range"); } return new ExtendedCommunity( typeByte, (byte) (type & 0xFF), globalAdministrator, localAdministrator); }
ExtendedCommunity extends Community { public static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator) { checkArgument( type >= 0 && type <= 0xFFFF, "Extended community type %s is not within the allowed range", type); byte typeByte = (byte) (type >> 8); checkArgument( _validTypes.contains(typeByte), "Not a valid BGP extended community type: %s", type); checkArgument( globalAdministrator >= 0 && localAdministrator >= 0, "Administrator values must be positive"); if (typeByte == 0x00 || typeByte == 0x40) { checkArgument( globalAdministrator <= 0xFFFFL && localAdministrator <= 0xFFFFFFFFL, "Extended community administrator values are not within the allowed range"); } else { checkArgument( globalAdministrator <= 0xFFFFFFFFL && localAdministrator <= 0xFFFFL, "Extended community administrator values are not within the allowed range"); } return new ExtendedCommunity( typeByte, (byte) (type & 0xFF), globalAdministrator, localAdministrator); } }
ExtendedCommunity extends Community { public static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator) { checkArgument( type >= 0 && type <= 0xFFFF, "Extended community type %s is not within the allowed range", type); byte typeByte = (byte) (type >> 8); checkArgument( _validTypes.contains(typeByte), "Not a valid BGP extended community type: %s", type); checkArgument( globalAdministrator >= 0 && localAdministrator >= 0, "Administrator values must be positive"); if (typeByte == 0x00 || typeByte == 0x40) { checkArgument( globalAdministrator <= 0xFFFFL && localAdministrator <= 0xFFFFFFFFL, "Extended community administrator values are not within the allowed range"); } else { checkArgument( globalAdministrator <= 0xFFFFFFFFL && localAdministrator <= 0xFFFFL, "Extended community administrator values are not within the allowed range"); } return new ExtendedCommunity( typeByte, (byte) (type & 0xFF), globalAdministrator, localAdministrator); } private  ExtendedCommunity(
      byte type, byte subType, long globalAdministrator, long localAdministrator); }
ExtendedCommunity extends Community { public static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator) { checkArgument( type >= 0 && type <= 0xFFFF, "Extended community type %s is not within the allowed range", type); byte typeByte = (byte) (type >> 8); checkArgument( _validTypes.contains(typeByte), "Not a valid BGP extended community type: %s", type); checkArgument( globalAdministrator >= 0 && localAdministrator >= 0, "Administrator values must be positive"); if (typeByte == 0x00 || typeByte == 0x40) { checkArgument( globalAdministrator <= 0xFFFFL && localAdministrator <= 0xFFFFFFFFL, "Extended community administrator values are not within the allowed range"); } else { checkArgument( globalAdministrator <= 0xFFFFFFFFL && localAdministrator <= 0xFFFFL, "Extended community administrator values are not within the allowed range"); } return new ExtendedCommunity( typeByte, (byte) (type & 0xFF), globalAdministrator, localAdministrator); } private  ExtendedCommunity(
      byte type, byte subType, long globalAdministrator, long localAdministrator); @Nonnull static ExtendedCommunity parse(String communityStr); @Nonnull static Optional<ExtendedCommunity> tryParse(String text); static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator); static ExtendedCommunity of(int type, Ip globalAdministrator, long localAdministrator); static ExtendedCommunity target(long asn, long value); @Override T accept(CommunityVisitor<T> visitor); @Override boolean isTransitive(); boolean isRouteOrigin(); boolean isRouteTarget(); boolean isVpnDistinguisher(); long getGlobalAdministrator(); long getLocalAdministrator(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Nonnull @Override String matchString(); @Override @Nonnull @JsonValue String toString(); }
ExtendedCommunity extends Community { public static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator) { checkArgument( type >= 0 && type <= 0xFFFF, "Extended community type %s is not within the allowed range", type); byte typeByte = (byte) (type >> 8); checkArgument( _validTypes.contains(typeByte), "Not a valid BGP extended community type: %s", type); checkArgument( globalAdministrator >= 0 && localAdministrator >= 0, "Administrator values must be positive"); if (typeByte == 0x00 || typeByte == 0x40) { checkArgument( globalAdministrator <= 0xFFFFL && localAdministrator <= 0xFFFFFFFFL, "Extended community administrator values are not within the allowed range"); } else { checkArgument( globalAdministrator <= 0xFFFFFFFFL && localAdministrator <= 0xFFFFL, "Extended community administrator values are not within the allowed range"); } return new ExtendedCommunity( typeByte, (byte) (type & 0xFF), globalAdministrator, localAdministrator); } private  ExtendedCommunity(
      byte type, byte subType, long globalAdministrator, long localAdministrator); @Nonnull static ExtendedCommunity parse(String communityStr); @Nonnull static Optional<ExtendedCommunity> tryParse(String text); static ExtendedCommunity of(int type, long globalAdministrator, long localAdministrator); static ExtendedCommunity of(int type, Ip globalAdministrator, long localAdministrator); static ExtendedCommunity target(long asn, long value); @Override T accept(CommunityVisitor<T> visitor); @Override boolean isTransitive(); boolean isRouteOrigin(); boolean isRouteTarget(); boolean isVpnDistinguisher(); long getGlobalAdministrator(); long getLocalAdministrator(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Nonnull @Override String matchString(); @Override @Nonnull @JsonValue String toString();  }