mirror of
https://github.com/fankes/moshi.git
synced 2025-10-20 00:19:21 +08:00
Document thread safety
This commit is contained in:
@@ -30,6 +30,11 @@ import okio.BufferedSource;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts Java values to JSON, and JSON values to Java.
|
* Converts Java values to JSON, and JSON values to Java.
|
||||||
|
*
|
||||||
|
* <p>JsonAdapter instances provided by Moshi are thread-safe, meaning multiple threads can safely
|
||||||
|
* use a single instance concurrently.
|
||||||
|
*
|
||||||
|
* <p>Custom JsonAdapter implementations should be designed to be thread-safe.
|
||||||
*/
|
*/
|
||||||
public abstract class JsonAdapter<T> {
|
public abstract class JsonAdapter<T> {
|
||||||
@CheckReturnValue public abstract @Nullable T fromJson(JsonReader reader) throws IOException;
|
@CheckReturnValue public abstract @Nullable T fromJson(JsonReader reader) throws IOException;
|
||||||
|
@@ -39,6 +39,9 @@ import static com.squareup.moshi.internal.Util.typeAnnotatedWithAnnotations;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Coordinates binding between JSON values and Java objects.
|
* Coordinates binding between JSON values and Java objects.
|
||||||
|
*
|
||||||
|
* <p>Moshi instances are thread-safe, meaning multiple threads can safely use a single instance
|
||||||
|
* concurrently.
|
||||||
*/
|
*/
|
||||||
public final class Moshi {
|
public final class Moshi {
|
||||||
static final List<JsonAdapter.Factory> BUILT_IN_FACTORIES = new ArrayList<>(5);
|
static final List<JsonAdapter.Factory> BUILT_IN_FACTORIES = new ArrayList<>(5);
|
||||||
|
Reference in New Issue
Block a user