com.basho.riak.client.cap.DefaultResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of riak-client Show documentation
Show all versions of riak-client Show documentation
HttpClient-based client for Riak
package com.basho.riak.client.cap;
import java.util.Collection;
/**
* A conflict resolver that doesn't resolve conflict. If it is presented with a
* collection of siblings with more than one entry it throws an {@link UnresolvedConflictException}.
*
* @author russell
*
* @see UnresolvedConflictException
*/
public final class DefaultResolver implements ConflictResolver {
/**
* Detects conflict but does not resolve it.
* @return null or the single value in the collection
* @throws UnresolvedConflictException if siblings
as > 1 entry.
*/
public T resolve(Collection siblings) {
if (siblings.size() > 1) {
throw new UnresolvedConflictException("Siblings found", siblings);
} else if (siblings.size() == 1) {
return siblings.iterator().next();
} else {
return null;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy