22
33import io .ably .lib .objects .batch .BatchContextBuilder ;
44import io .ably .lib .types .Callback ;
5+ import org .jetbrains .annotations .NotNull ;
6+
57
68import java .util .Map ;
79
810/**
911 * The LiveObjects interface provides methods to interact with live data objects,
1012 * such as maps and counters, in a real-time environment. It supports both synchronous
1113 * and asynchronous operations for retrieving and creating live objects.
14+ *
15+ * <p>Implementations of this interface must be thread-safe as they may be accessed
16+ * from multiple threads concurrently.
1217 */
1318public interface LiveObjects {
1419
@@ -17,91 +22,96 @@ public interface LiveObjects {
1722 *
1823 * @return the root LiveMap instance.
1924 */
25+ @ NotNull
2026 LiveMap getRoot ();
2127
2228 /**
2329 * Initiates a batch operation and provides a BatchContext through a callback.
2430 *
25- * @param batchContextCallback the callback to handle the BatchContext or error .
31+ * @param batchContextCallback the builder to configure the batch operation .
2632 */
27- void batch (BatchContextBuilder batchContextCallback );
33+ void batch (@ NotNull BatchContextBuilder batchContextCallback );
2834
2935 /**
3036 * Creates a new LiveMap based on an existing LiveMap.
3137 *
3238 * @param liveMap the existing LiveMap to base the new LiveMap on.
3339 * @return the newly created LiveMap instance.
3440 */
35- LiveMap createMap (LiveMap liveMap );
41+ @ NotNull
42+ LiveMap createMap (@ NotNull LiveMap liveMap );
3643
3744 /**
3845 * Creates a new LiveMap based on a LiveCounter.
3946 *
4047 * @param liveCounter the LiveCounter to base the new LiveMap on.
4148 * @return the newly created LiveMap instance.
4249 */
43- LiveMap createMap (LiveCounter liveCounter );
50+ @ NotNull
51+ LiveMap createMap (@ NotNull LiveCounter liveCounter );
4452
4553 /**
4654 * Creates a new LiveMap based on a standard Java Map.
4755 *
4856 * @param map the Java Map to base the new LiveMap on.
4957 * @return the newly created LiveMap instance.
5058 */
51- LiveMap createMap (Map <String , Object > map );
59+ @ NotNull
60+ LiveMap createMap (@ NotNull Map <String , Object > map );
5261
5362 /**
5463 * Creates a new LiveCounter with an initial value.
5564 *
5665 * @param initialValue the initial value of the LiveCounter.
5766 * @return the newly created LiveCounter instance.
5867 */
59- LiveCounter createCounter (Long initialValue );
68+ @ NotNull
69+ LiveCounter createCounter (@ NotNull Long initialValue );
6070
6171 /**
6272 * Asynchronously retrieves the root LiveMap object.
6373 *
6474 * @param callback the callback to handle the result or error.
6575 */
66- void getRootAsync (Callback <LiveMap > callback );
76+ void getRootAsync (@ NotNull Callback <@ NotNull LiveMap > callback );
6777
6878 /**
6979 * Initiates a batch operation asynchronously.
7080 *
71- * @param batchContextCallback the BatchContextBuilder to build the BatchContext .
81+ * @param batchContextCallback the builder to configure the batch operation .
7282 * @param callback the Callback to handle the completion or error of the batch operation.
7383 */
74- void batchAsync (BatchContextBuilder batchContextCallback , Callback <Void > callback );
84+ void batchAsync (@ NotNull BatchContextBuilder batchContextCallback , @ NotNull Callback <Void > callback );
7585
7686 /**
7787 * Asynchronously creates a new LiveMap based on an existing LiveMap.
7888 *
7989 * @param liveMap the existing LiveMap to base the new LiveMap on.
8090 * @param callback the callback to handle the result or error.
8191 */
82- void createMapAsync (LiveMap liveMap , Callback <LiveMap > callback );
92+ void createMapAsync (@ NotNull LiveMap liveMap , @ NotNull Callback <@ NotNull LiveMap > callback );
8393
8494 /**
8595 * Asynchronously creates a new LiveMap based on a LiveCounter.
8696 *
8797 * @param liveCounter the LiveCounter to base the new LiveMap on.
8898 * @param callback the callback to handle the result or error.
8999 */
90- void createMapAsync (LiveCounter liveCounter , Callback <LiveMap > callback );
100+ void createMapAsync (@ NotNull LiveCounter liveCounter , @ NotNull Callback <@ NotNull LiveMap > callback );
91101
92102 /**
93103 * Asynchronously creates a new LiveMap based on a standard Java Map.
94104 *
95105 * @param map the Java Map to base the new LiveMap on.
96106 * @param callback the callback to handle the result or error.
97107 */
98- void createMapAsync (Map <String , Object > map , Callback <LiveMap > callback );
108+ void createMapAsync (@ NotNull Map <String , Object > map , @ NotNull Callback <@ NotNull LiveMap > callback );
99109
100110 /**
101111 * Asynchronously creates a new LiveCounter with an initial value.
102112 *
103113 * @param initialValue the initial value of the LiveCounter.
104114 * @param callback the callback to handle the result or error.
105115 */
106- void createCounterAsync (Long initialValue , Callback <LiveCounter > callback );
116+ void createCounterAsync (@ NotNull Long initialValue , @ NotNull Callback <@ NotNull LiveCounter > callback );
107117}
0 commit comments