mirror of https://github.com/apache/jclouds.git
fixed node predicate
This commit is contained in:
parent
8bb518bb33
commit
7127e5f322
|
@ -29,7 +29,7 @@ import org.jclouds.util.Preconditions2;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container for node filters (predicates).
|
* Container for node filters (predicates).
|
||||||
|
@ -160,13 +160,13 @@ public class NodePredicates {
|
||||||
* ids of the resources
|
* ids of the resources
|
||||||
* @return predicate
|
* @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");
|
checkNotNull(ids, "ids must be defined");
|
||||||
final Set<String> search = Sets.newHashSet(ids);
|
final Set<String> search = ImmutableSet.copyOf(ids);
|
||||||
return new Predicate<ComputeMetadata>() {
|
return new Predicate<T>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(ComputeMetadata nodeMetadata) {
|
public boolean apply(T nodeMetadata) {
|
||||||
return search.contains(nodeMetadata.getProviderId());
|
return search.contains(nodeMetadata.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue