Add interface for DB tasks will nullable results.

This commit is contained in:
akwizgran
2018-11-12 12:13:26 +00:00
parent b24914408d
commit ecb63d1acb
6 changed files with 38 additions and 14 deletions

View File

@@ -95,7 +95,7 @@ public interface DatabaseComponent {
*/
@Nullable
<R, E extends Exception> R transactionWithNullableResult(boolean readOnly,
DbCallable<R, E> task) throws DbException, E;
NullableDbCallable<R, E> task) throws DbException, E;
/**
* Stores a contact associated with the given local and remote pseudonyms,

View File

@@ -2,11 +2,8 @@ package org.briarproject.bramble.api.db;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.Nullable;
@NotNullByDefault
public interface DbCallable<R, E extends Exception> {
@Nullable
R call(Transaction txn) throws DbException, E;
}

View File

@@ -0,0 +1,12 @@
package org.briarproject.bramble.api.db;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.Nullable;
@NotNullByDefault
public interface NullableDbCallable<R, E extends Exception> {
@Nullable
R call(Transaction txn) throws DbException, E;
}