org.infinispan.api.common.process.CacheEntryProcessorResult Maven / Gradle / Ivy
The newest version!
package org.infinispan.api.common.process;
import org.infinispan.api.Experimental;
/**
* Write result for process operations on the Cache
*
* @since 14.0
*/
@Experimental
public interface CacheEntryProcessorResult {
K key();
T result();
Throwable error();
static CacheEntryProcessorResult onResult(K key, T result) {
return new Impl<>(key, result, null);
}
static CacheEntryProcessorResult onError(K key, Throwable throwable) {
return new Impl<>(key, null, throwable);
}
class Impl implements CacheEntryProcessorResult {
private final K key;
private final T result;
private final Throwable throwable;
public Impl(K key, T result, Throwable throwable) {
this.key = key;
this.result = result;
this.throwable = throwable;
}
@Override
public K key() {
return key;
}
@Override
public T result() {
return result;
}
@Override
public Throwable error() {
return throwable;
}
}
}