> @@ -169,7 +170,10 @@ public boolean apply(Droplet droplet) {
>  
>     @Override
>     public Image getImage(String id) {
> -      return api.getImageApi().get(Integer.parseInt(id));
> +      // The id of the image can be an id or a slug. Use the corresponding 
> method of the API depending on what is
> +      // provided. If it can be parsed as a number, use the method to get by 
> ID. Otherwise, get by slug.
> +      Integer imageId = Ints.tryParse(id);
> +      return imageId != null ? api.getImageApi().get(imageId) : 
> api.getImageApi().get(id);

This is also seen int he `ImageExtension.deleteImage` method.

The thing here is that the `ImageApi` is just the API interface with the REST 
annotations and there is no implementation.  It provides two methods, one 
accepting an integer (the id) and one accepting a string (the slug), and I see 
no elegant way to provide that convenience method. Did you have something in 
mind?

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

Reply via email to