diff --git a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV09FromJson.java b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV09FromJson.java index f5c048751d..5c94e41f72 100644 --- a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV09FromJson.java +++ b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV09FromJson.java @@ -26,7 +26,7 @@ import org.jclouds.http.HttpResponse; import org.jclouds.http.functions.ParseJson; import com.google.common.base.Function; -import com.google.common.collect.Iterables; +import static com.google.common.collect.Iterables.getFirst; /** * Parses the cookbook versions in a Chef Server <= 0.9.8. @@ -44,8 +44,8 @@ public class ParseCookbookVersionsV09FromJson implements Function apply(HttpResponse arg0) { - return Iterables.getFirst(json.apply(arg0).values(), null); + public Set apply(HttpResponse response) { + return getFirst(json.apply(response).values(), null); } } diff --git a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV10FromJson.java b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV10FromJson.java index 4a34374f5b..955fe8e184 100644 --- a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV10FromJson.java +++ b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseCookbookVersionsV10FromJson.java @@ -28,8 +28,9 @@ import org.jclouds.http.HttpResponse; import org.jclouds.http.functions.ParseJson; import com.google.common.base.Function; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; +import static com.google.common.collect.Iterables.getFirst; +import static com.google.common.collect.Iterables.transform; +import static com.google.common.collect.Sets.newLinkedHashSet; /** * Parses the cookbook versions in a Chef Server >= 0.10.8. @@ -49,8 +50,8 @@ public class ParseCookbookVersionsV10FromJson implements Function apply(HttpResponse response) { - CookbookDefinition def = Iterables.getFirst(parser.apply(response).values(), null); - return Sets.newLinkedHashSet(Iterables.transform(def.getVersions(), new Function() { + CookbookDefinition def = getFirst(parser.apply(response).values(), null); + return newLinkedHashSet(transform(def.getVersions(), new Function() { @Override public String apply(Version input) { return input.getVersion(); diff --git a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchDatabagFromJson.java b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchDatabagFromJson.java index 90aebd3ff0..4826b38c7b 100644 --- a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchDatabagFromJson.java +++ b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchDatabagFromJson.java @@ -29,8 +29,8 @@ import org.jclouds.http.functions.ParseJson; import org.jclouds.json.Json; import com.google.common.base.Function; -import com.google.common.collect.Iterables; import com.google.gson.annotations.SerializedName; +import static com.google.common.collect.Iterables.transform; /** * Parses the search result into a {@link DatabagItem} object. @@ -64,9 +64,9 @@ public class ParseSearchDatabagFromJson implements Function apply(HttpResponse arg0) { - Response returnVal = responseParser.apply(arg0); - Iterable items = Iterables.transform(returnVal.rows, new Function() { + public SearchResult apply(HttpResponse response) { + Response returnVal = responseParser.apply(response); + Iterable items = transform(returnVal.rows, new Function() { @Override public DatabagItem apply(Row input) { return json.fromJson(input.rawData.toString(), DatabagItem.class); diff --git a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchResultFromJson.java b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchResultFromJson.java index 2346638152..983ce8f173 100644 --- a/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchResultFromJson.java +++ b/apis/chef/src/main/java/org/jclouds/chef/functions/ParseSearchResultFromJson.java @@ -46,8 +46,8 @@ public class ParseSearchResultFromJson implements Function apply(HttpResponse arg0) { - Response returnVal = json.apply(arg0); + public SearchResult apply(HttpResponse response) { + Response returnVal = json.apply(response); return new SearchResult(returnVal.start, returnVal.rows); } }