Skip to content

Commit e108fd0

Browse files
committed
BoxStore: make setSyncClient() package private
1 parent 9b9b5fb commit e108fd0

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

objectbox-java/src/main/java/io/objectbox/BoxStore.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ public SyncClient getSyncClient() {
11781178
return syncClient;
11791179
}
11801180

1181-
public void setSyncClient(@Nullable SyncClient syncClient) {
1181+
void setSyncClient(@Nullable SyncClient syncClient) {
11821182
this.syncClient = syncClient;
11831183
}
11841184
}

objectbox-java/src/main/java/io/objectbox/InternalAccess.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package io.objectbox;
1818

1919
import io.objectbox.annotation.apihint.Internal;
20+
import io.objectbox.sync.SyncClient;
2021

2122
@Internal
2223
public class InternalAccess {
@@ -36,6 +37,10 @@ public static long getHandle(Transaction tx) {
3637
return tx.internalHandle();
3738
}
3839

40+
public static void setSyncClient(BoxStore boxStore, SyncClient syncClient) {
41+
boxStore.setSyncClient(syncClient);
42+
}
43+
3944
public static <T> void releaseReader(Box<T> box, Cursor<T> reader) {
4045
box.releaseReader(reader);
4146
}

objectbox-java/src/main/java/io/objectbox/sync/SyncClientImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public class SyncClientImpl implements SyncClient {
6363
setLoginCredentials(builder.credentials);
6464

6565
// If created successfully, let store keep a reference so the caller does not have to.
66-
builder.boxStore.setSyncClient(this);
66+
InternalAccess.setSyncClient(builder.boxStore, this);
6767

6868
if (!builder.manualStart) {
6969
start();
@@ -169,7 +169,7 @@ public void close() {
169169
if (boxStore != null) {
170170
SyncClient syncClient = boxStore.getSyncClient();
171171
if (syncClient == this) {
172-
boxStore.setSyncClient(null);
172+
InternalAccess.setSyncClient(boxStore, null);
173173
}
174174
this.boxStore = null;
175175
}

0 commit comments

Comments
 (0)