fixed node predicate

This commit is contained in:
Adrian Cole 2011-04-14 17:21:43 +01:00
parent 8bb518bb33
commit 7127e5f322
1 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ import org.jclouds.util.Preconditions2;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Sets;
import com.google.common.collect.ImmutableSet;
/**
* Container for node filters (predicates).
@ -160,13 +160,13 @@ public class NodePredicates {
* ids of the resources
* @return predicate
*/
public static Predicate<ComputeMetadata> withIds(String... ids) {
public static <T extends ComputeMetadata> Predicate<T> withIds(String... ids) {
checkNotNull(ids, "ids must be defined");
final Set<String> search = Sets.newHashSet(ids);
return new Predicate<ComputeMetadata>() {
final Set<String> search = ImmutableSet.copyOf(ids);
return new Predicate<T>() {
@Override
public boolean apply(ComputeMetadata nodeMetadata) {
return search.contains(nodeMetadata.getProviderId());
public boolean apply(T nodeMetadata) {
return search.contains(nodeMetadata.getId());
}
@Override