> +import com.google.common.base.Function;
> +import com.google.common.base.Supplier;
> +
> +@Singleton
> +public class VersionAwareRegionToEndpoint implements Function<Object, URI> {
> +
> +   private final Supplier<Map<String, Supplier<URI>>> 
> regionToEndpointSupplier;
> +
> +   @Inject
> +   public VersionAwareRegionToEndpoint(@Region Supplier<Map<String, 
> Supplier<URI>>> regionToEndpointSupplier) {
> +      this.regionToEndpointSupplier = checkNotNull(regionToEndpointSupplier, 
> "regionToEndpointSupplier");
> +   }
> +
> +   @Override
> +   public URI apply(@Nullable Object from) {
> +      checkArgument(from != null && from instanceof String, "you must 
> specify a region, as a String argument");

nit: if anything this should be an assertion error. base already checks null, 
and if something besides string was passed, only code change could fix it. ps. 
kill Nullable on input arg as you'll see how that doesn't make sense :)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/169/files#r20173763

Reply via email to