io.mapsmessaging.devices.sensorreadings.ComputationResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deviceLibrary Show documentation
Show all versions of deviceLibrary Show documentation
Provides a plugable Device integration and access
The newest version!
package io.mapsmessaging.devices.sensorreadings;
import lombok.Getter;
@Getter
public class ComputationResult {
private final T result;
private final Exception error;
private ComputationResult(T result, Exception error) {
this.result = result;
this.error = error;
}
public static ComputationResult success(T result) {
return new ComputationResult<>(result, null);
}
public static ComputationResult failure(Exception error) {
return new ComputationResult<>(null, error);
}
public boolean hasError() {
return error != null;
}
}