Index
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
A
- adapter(Class<T>) - Method in class com.squareup.moshi.Moshi
- adapter(Type) - Method in class com.squareup.moshi.Moshi
-
Returns a JSON adapter for
type
, creating it if necessary. - adapter(Type, Class<? extends Annotation>) - Method in class com.squareup.moshi.Moshi
- adapter(Type, Class<? extends Annotation>...) - Method in class com.squareup.moshi.Moshi
- adapter(Type, Set<? extends Annotation>) - Method in class com.squareup.moshi.Moshi
- adapter(Type, Set<? extends Annotation>, String) - Method in class com.squareup.moshi.Moshi
- add(JsonAdapter.Factory) - Method in class com.squareup.moshi.Moshi.Builder
- add(Object) - Method in class com.squareup.moshi.Moshi.Builder
- add(Type, JsonAdapter<T>) - Method in class com.squareup.moshi.Moshi.Builder
- add(Type, Class<? extends Annotation>, JsonAdapter<T>) - Method in class com.squareup.moshi.Moshi.Builder
- addLast(JsonAdapter.Factory) - Method in class com.squareup.moshi.Moshi.Builder
- addLast(Object) - Method in class com.squareup.moshi.Moshi.Builder
- addLast(Type, JsonAdapter<T>) - Method in class com.squareup.moshi.Moshi.Builder
- addLast(Type, Class<? extends Annotation>, JsonAdapter<T>) - Method in class com.squareup.moshi.Moshi.Builder
- arrayOf(Type) - Static method in class com.squareup.moshi.Types
-
Returns an array type whose elements are all instances of
componentType
.
B
- BEGIN_ARRAY - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
The opening of a JSON array.
- BEGIN_OBJECT - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
The opening of a JSON object.
- beginArray() - Method in class com.squareup.moshi.JsonReader
-
Consumes the next token from the JSON stream and asserts that it is the beginning of a new array.
- beginArray() - Method in class com.squareup.moshi.JsonWriter
-
Begins encoding a new array.
- beginFlatten() - Method in class com.squareup.moshi.JsonWriter
-
Cancels immediately-nested calls to
JsonWriter.beginArray()
orJsonWriter.beginObject()
and their matching calls toJsonWriter.endArray()
orJsonWriter.endObject()
. - beginObject() - Method in class com.squareup.moshi.JsonReader
-
Consumes the next token from the JSON stream and asserts that it is the beginning of a new object.
- beginObject() - Method in class com.squareup.moshi.JsonWriter
-
Begins encoding a new object.
- BOOLEAN - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
A JSON
true
orfalse
. - boxIfPrimitive(Class<T>) - Static method in class com.squareup.moshi.internal.Util
- build() - Method in class com.squareup.moshi.Moshi.Builder
- Builder() - Constructor for class com.squareup.moshi.Moshi.Builder
C
- canonicalize(Type) - Static method in class com.squareup.moshi.internal.Util
-
Returns a type that is functionally equal but not necessarily equal according to
Object.equals()
. - collectionElementType(Type, Class<?>) - Static method in class com.squareup.moshi.Types
-
Returns the element type of this collection type.
- com.squareup.moshi - package com.squareup.moshi
-
Moshi is modern JSON library for Android and Java.
- com.squareup.moshi.internal - package com.squareup.moshi.internal
- create(Type, Set<? extends Annotation>, Moshi) - Method in interface com.squareup.moshi.JsonAdapter.Factory
-
Attempts to create an adapter for
type
annotated withannotations
.
D
- DEFAULT_CONSTRUCTOR_MARKER - Static variable in class com.squareup.moshi.internal.Util
- delegate() - Method in class com.squareup.moshi.internal.NonNullJsonAdapter
- delegate() - Method in class com.squareup.moshi.internal.NullSafeJsonAdapter
E
- EMPTY_TYPE_ARRAY - Static variable in class com.squareup.moshi.internal.Util
- END_ARRAY - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
The closing of a JSON array.
- END_DOCUMENT - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
The end of the JSON stream.
- END_OBJECT - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
The closing of a JSON object.
- endArray() - Method in class com.squareup.moshi.JsonReader
-
Consumes the next token from the JSON stream and asserts that it is the end of the current array.
- endArray() - Method in class com.squareup.moshi.JsonWriter
-
Ends encoding the current array.
- endFlatten(int) - Method in class com.squareup.moshi.JsonWriter
-
Ends nested call flattening created by
JsonWriter.beginFlatten()
. - endObject() - Method in class com.squareup.moshi.JsonReader
-
Consumes the next token from the JSON stream and asserts that it is the end of the current object.
- endObject() - Method in class com.squareup.moshi.JsonWriter
-
Ends encoding the current object.
- equals(Object) - Method in class com.squareup.moshi.internal.Util.GenericArrayTypeImpl
- equals(Object) - Method in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- equals(Object) - Method in class com.squareup.moshi.internal.Util.WildcardTypeImpl
- equals(Type, Type) - Static method in class com.squareup.moshi.Types
-
Returns true if
a
andb
are equal.
F
- failOnUnknown() - Method in class com.squareup.moshi.JsonAdapter
-
Returns a JSON adapter equal to this, but that throws a
JsonDataException
when unknown names and values are encountered. - failOnUnknown() - Method in class com.squareup.moshi.JsonReader
-
Returns true if this parser forbids skipping names and values.
- fromJson(JsonReader) - Method in class com.squareup.moshi.internal.NonNullJsonAdapter
- fromJson(JsonReader) - Method in class com.squareup.moshi.internal.NullSafeJsonAdapter
- fromJson(JsonReader) - Method in class com.squareup.moshi.JsonAdapter
-
Decodes a nullable instance of type
JsonAdapter
from the givenreader
. - fromJson(String) - Method in class com.squareup.moshi.JsonAdapter
-
Decodes a nullable instance of type
JsonAdapter
from the givenstring
. - fromJson(BufferedSource) - Method in class com.squareup.moshi.JsonAdapter
-
Decodes a nullable instance of type
JsonAdapter
from the givensource
. - FromJson - Annotation Interface in com.squareup.moshi
- fromJsonValue(Object) - Method in class com.squareup.moshi.JsonAdapter
-
Decodes a Java value object from
value
, which must be comprised of maps, lists, strings, numbers, booleans and nulls.
G
- generateAdapter() - Element in annotation interface com.squareup.moshi.JsonClass
-
True to trigger the annotation processor to generate an adapter for this type.
- generatedAdapter(Moshi, Type, Class<?>) - Static method in class com.squareup.moshi.internal.Util
-
Loads the generated JsonAdapter for classes annotated
JsonClass
. - generatedJsonAdapterName(Class<?>) - Static method in class com.squareup.moshi.Types
-
Resolves the generated
JsonAdapter
fully qualified class name for a givenJsonClass-annotated
clazz
. - generatedJsonAdapterName(String) - Static method in class com.squareup.moshi.Types
-
Resolves the generated
JsonAdapter
fully qualified class name for a givenJsonClass-annotated
className
. - generator() - Element in annotation interface com.squareup.moshi.JsonClass
-
An optional custom generator tag used to indicate which generator should be used.
- GenericArrayTypeImpl(Type) - Constructor for class com.squareup.moshi.internal.Util.GenericArrayTypeImpl
- getActualTypeArguments() - Method in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- getFieldJsonQualifierAnnotations(Class<?>, String) - Static method in class com.squareup.moshi.Types
-
Deprecated.this is no longer needed in Kotlin 1.6.0 (which has direct annotation instantiation) and is obsolete.
- getGenericComponentType() - Method in class com.squareup.moshi.internal.Util.GenericArrayTypeImpl
- getGenericSupertype(Type, Class<?>, Class<?>) - Static method in class com.squareup.moshi.internal.Util
-
Returns the generic supertype for
supertype
. - getIndent() - Method in class com.squareup.moshi.JsonWriter
-
Returns a string containing only whitespace, used for each level of indentation.
- getLowerBounds() - Method in class com.squareup.moshi.internal.Util.WildcardTypeImpl
- getOwnerType() - Method in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- getPath() - Method in class com.squareup.moshi.JsonReader
-
Returns a JsonPath to the current location in the JSON value.
- getPath() - Method in class com.squareup.moshi.JsonWriter
-
Returns a JsonPath to the current location in the JSON value.
- getRawType() - Method in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- getRawType(Type) - Static method in class com.squareup.moshi.Types
- getSerializeNulls() - Method in class com.squareup.moshi.JsonWriter
-
Returns true if object members are serialized when their value is null.
- getUpperBounds() - Method in class com.squareup.moshi.internal.Util.WildcardTypeImpl
H
- hashCode() - Method in class com.squareup.moshi.internal.Util.GenericArrayTypeImpl
- hashCode() - Method in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- hashCode() - Method in class com.squareup.moshi.internal.Util.WildcardTypeImpl
- hasNext() - Method in class com.squareup.moshi.JsonReader
-
Returns true if the current array or object has another element.
- hasNullable(Annotation[]) - Static method in class com.squareup.moshi.internal.Util
-
Returns true if
annotations
has any annotation whose simple name is Nullable.
I
- ignore() - Element in annotation interface com.squareup.moshi.Json
-
If true, this field/property will be ignored.
- indent(String) - Method in class com.squareup.moshi.JsonAdapter
-
Return a JSON adapter equal to this, but using
indent
to control how the result is formatted. - isAnnotationPresent(Set<? extends Annotation>, Class<? extends Annotation>) - Static method in class com.squareup.moshi.internal.Util
- isKotlin(Class<?>) - Static method in class com.squareup.moshi.internal.Util
- isLenient() - Method in class com.squareup.moshi.JsonReader
-
Returns true if this parser is liberal in what it accepts.
- isLenient() - Method in class com.squareup.moshi.JsonWriter
-
Returns true if this writer has relaxed syntax rules.
- isPlatformType(Class<?>) - Static method in class com.squareup.moshi.internal.Util
-
Returns true if
rawType
is built in.
J
- Json - Annotation Interface in com.squareup.moshi
-
Customizes how a field is encoded as JSON.
- JsonAdapter<T> - Class in com.squareup.moshi
-
Converts Java values to JSON, and JSON values to Java.
- JsonAdapter() - Constructor for class com.squareup.moshi.JsonAdapter
- JsonAdapter.Factory - Interface in com.squareup.moshi
- jsonAnnotations(Annotation[]) - Static method in class com.squareup.moshi.internal.Util
- jsonAnnotations(AnnotatedElement) - Static method in class com.squareup.moshi.internal.Util
- JsonClass - Annotation Interface in com.squareup.moshi
-
Customizes how a type is encoded as JSON.
- JsonDataException - Exception in com.squareup.moshi
-
Thrown when the data in a JSON document doesn't match the data expected by the caller.
- JsonDataException() - Constructor for exception com.squareup.moshi.JsonDataException
- JsonDataException(String) - Constructor for exception com.squareup.moshi.JsonDataException
- JsonDataException(String, Throwable) - Constructor for exception com.squareup.moshi.JsonDataException
- JsonDataException(Throwable) - Constructor for exception com.squareup.moshi.JsonDataException
- JsonEncodingException - Exception in com.squareup.moshi
-
Thrown when the data being parsed is not encoded as valid JSON.
- JsonEncodingException(String) - Constructor for exception com.squareup.moshi.JsonEncodingException
- jsonName(String, Json) - Static method in class com.squareup.moshi.internal.Util
- jsonName(String, AnnotatedElement) - Static method in class com.squareup.moshi.internal.Util
- JsonQualifier - Annotation Interface in com.squareup.moshi
-
Annotates another annotation, causing it to specialize how values are encoded and decoded.
- JsonReader - Class in com.squareup.moshi
-
Reads a JSON (RFC 7159) encoded value as a stream of tokens.
- JsonReader.Options - Class in com.squareup.moshi
-
A set of strings to be chosen with
JsonReader.selectName(com.squareup.moshi.JsonReader.Options)
orJsonReader.selectString(com.squareup.moshi.JsonReader.Options)
. - JsonReader.Token - Enum Class in com.squareup.moshi
-
A structure, name, or value type in a JSON-encoded string.
- jsonValue(Object) - Method in class com.squareup.moshi.JsonWriter
-
Encodes the value which may be a string, number, boolean, null, map, or list.
- JsonWriter - Class in com.squareup.moshi
-
Writes a JSON (RFC 7159) encoded value to a stream, one token at a time.
L
- lenient() - Method in class com.squareup.moshi.JsonAdapter
-
Returns a JSON adapter equal to this, but is lenient when reading and writing.
- lookupDefaultsConstructor(Class<T>) - Static method in class com.squareup.moshi.internal.Util
-
Reflectively looks up the defaults constructor of a kotlin class.
M
- missingProperty(String, String, JsonReader) - Static method in class com.squareup.moshi.internal.Util
- Moshi - Class in com.squareup.moshi
-
Coordinates binding between JSON values and Java objects.
- Moshi.Builder - Class in com.squareup.moshi
N
- name() - Element in annotation interface com.squareup.moshi.Json
-
The name of the field when encoded as JSON.
- name(String) - Method in class com.squareup.moshi.JsonWriter
-
Encodes the property name.
- NAME - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
A JSON property name.
- newBuilder() - Method in class com.squareup.moshi.Moshi
-
Returns a new builder containing all custom factories used by the current instance.
- newParameterizedType(Type, Type...) - Static method in class com.squareup.moshi.Types
-
Returns a new parameterized type, applying
typeArguments
torawType
. - newParameterizedTypeWithOwner(Type, Type, Type...) - Static method in class com.squareup.moshi.Types
-
Returns a new parameterized type, applying
typeArguments
torawType
. - nextAdapter(JsonAdapter.Factory, Type, Set<? extends Annotation>) - Method in class com.squareup.moshi.Moshi
- nextAnnotations(Set<? extends Annotation>, Class<? extends Annotation>) - Static method in class com.squareup.moshi.Types
-
Checks if
annotations
containsjsonQualifier
. - nextBoolean() - Method in class com.squareup.moshi.JsonReader
-
Returns the boolean value of the next token, consuming it.
- nextDouble() - Method in class com.squareup.moshi.JsonReader
-
Returns the double value of the next token, consuming it.
- nextInt() - Method in class com.squareup.moshi.JsonReader
-
Returns the int value of the next token, consuming it.
- nextLong() - Method in class com.squareup.moshi.JsonReader
-
Returns the long value of the next token, consuming it.
- nextName() - Method in class com.squareup.moshi.JsonReader
-
Returns the next token, a property name, and consumes it.
- nextNull() - Method in class com.squareup.moshi.JsonReader
-
Consumes the next token from the JSON stream and asserts that it is a literal null.
- nextSource() - Method in class com.squareup.moshi.JsonReader
-
Returns the next value as a stream of UTF-8 bytes and consumes it.
- nextString() - Method in class com.squareup.moshi.JsonReader
-
Returns the string value of the next token, consuming it.
- NO_ANNOTATIONS - Static variable in class com.squareup.moshi.internal.Util
- nonNull() - Method in class com.squareup.moshi.JsonAdapter
-
Returns a JSON adapter equal to this JSON adapter, but that refuses null values.
- NonNullJsonAdapter<T> - Class in com.squareup.moshi.internal
- NonNullJsonAdapter(JsonAdapter<T>) - Constructor for class com.squareup.moshi.internal.NonNullJsonAdapter
- NULL - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
A JSON
null
. - nullSafe() - Method in class com.squareup.moshi.JsonAdapter
-
Returns a JSON adapter equal to this JSON adapter, but with support for reading and writing nulls.
- NullSafeJsonAdapter<T> - Class in com.squareup.moshi.internal
- NullSafeJsonAdapter(JsonAdapter<T>) - Constructor for class com.squareup.moshi.internal.NullSafeJsonAdapter
- nullValue() - Method in class com.squareup.moshi.JsonWriter
-
Encodes
null
. - NUMBER - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
A JSON number represented in this API by a Java
double
,long
, orint
.
O
- of(String...) - Static method in class com.squareup.moshi.JsonReader.Options
- of(BufferedSink) - Static method in class com.squareup.moshi.JsonWriter
-
Returns a new instance that writes UTF-8 encoded JSON to
sink
. - of(BufferedSource) - Static method in class com.squareup.moshi.JsonReader
-
Returns a new instance that reads UTF-8 encoded JSON from
source
.
P
- ParameterizedTypeImpl(Type, Type, Type...) - Constructor for class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- peek() - Method in class com.squareup.moshi.JsonReader
-
Returns the type of the next token without consuming it.
- peekJson() - Method in class com.squareup.moshi.JsonReader
-
Returns a new
JsonReader
that can read data from thisJsonReader
without consuming it. - promoteNameToValue() - Method in class com.squareup.moshi.JsonReader
-
Changes the reader to treat the next name as a string value.
- promoteValueToName() - Method in class com.squareup.moshi.JsonWriter
-
Changes the writer to treat the next value as a string name.
R
- readJsonValue() - Method in class com.squareup.moshi.JsonReader
-
Returns the value of the next token, consuming it.
- removeSubtypeWildcard(Type) - Static method in class com.squareup.moshi.internal.Util
-
If type is a "? extends X" wildcard, returns X; otherwise returns type unchanged.
- resolve(Type, Class<?>, Type) - Static method in class com.squareup.moshi.internal.Util
- rethrowCause(InvocationTargetException) - Static method in class com.squareup.moshi.internal.Util
-
Throws the cause of
e
, wrapping it if it is checked.
S
- selectName(JsonReader.Options) - Method in class com.squareup.moshi.JsonReader
-
If the next token is a property name that's in
options
, this consumes it and returns its index. - selectString(JsonReader.Options) - Method in class com.squareup.moshi.JsonReader
-
If the next token is a string that's in
options
, this consumes it and returns its index. - serializeNulls() - Method in class com.squareup.moshi.JsonAdapter
-
Returns a JSON adapter equal to this JSON adapter, but that serializes nulls when encoding JSON.
- setFailOnUnknown(boolean) - Method in class com.squareup.moshi.JsonReader
-
Configure whether this parser throws a
JsonDataException
whenJsonReader.skipValue()
is called. - setIndent(String) - Method in class com.squareup.moshi.JsonWriter
-
Sets the indentation string to be repeated for each level of indentation in the encoded document.
- setLenient(boolean) - Method in class com.squareup.moshi.JsonReader
-
Configure this parser to be liberal in what it accepts.
- setLenient(boolean) - Method in class com.squareup.moshi.JsonWriter
-
Configure this writer to relax its syntax rules.
- setSerializeNulls(boolean) - Method in class com.squareup.moshi.JsonWriter
-
Sets whether object members are serialized when their value is null.
- setTag(Class<T>, T) - Method in class com.squareup.moshi.JsonReader
-
Assigns the tag value using the given class key and value.
- setTag(Class<T>, T) - Method in class com.squareup.moshi.JsonWriter
-
Assigns the tag value using the given class key and value.
- skipName() - Method in class com.squareup.moshi.JsonReader
-
Skips the next token, consuming it.
- skipValue() - Method in class com.squareup.moshi.JsonReader
-
Skips the next value recursively.
- STRING - Enum constant in enum class com.squareup.moshi.JsonReader.Token
-
A JSON string.
- strings() - Method in class com.squareup.moshi.JsonReader.Options
-
Returns a copy of this
Option's
strings. - subtypeOf(Type) - Static method in class com.squareup.moshi.Types
-
Returns a type that represents an unknown type that extends
bound
. - supertypeOf(Type) - Static method in class com.squareup.moshi.Types
-
Returns a type that represents an unknown supertype of
bound
.
T
- tag(Class<T>) - Method in class com.squareup.moshi.JsonReader
-
Returns the tag value for the given class key.
- tag(Class<T>) - Method in class com.squareup.moshi.JsonWriter
-
Returns the tag value for the given class key.
- toJson(JsonWriter, T) - Method in class com.squareup.moshi.internal.NonNullJsonAdapter
- toJson(JsonWriter, T) - Method in class com.squareup.moshi.internal.NullSafeJsonAdapter
- toJson(JsonWriter, T) - Method in class com.squareup.moshi.JsonAdapter
-
Encodes the given
value
with the givenwriter
. - toJson(BufferedSink, T) - Method in class com.squareup.moshi.JsonAdapter
- toJson(T) - Method in class com.squareup.moshi.JsonAdapter
-
Encodes the given
value
into a String and returns it. - ToJson - Annotation Interface in com.squareup.moshi
- toJsonValue(T) - Method in class com.squareup.moshi.JsonAdapter
-
Encodes
value
as a Java value object comprised of maps, lists, strings, numbers, booleans, and nulls. - toString() - Method in class com.squareup.moshi.internal.NonNullJsonAdapter
- toString() - Method in class com.squareup.moshi.internal.NullSafeJsonAdapter
- toString() - Method in class com.squareup.moshi.internal.Util.GenericArrayTypeImpl
- toString() - Method in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- toString() - Method in class com.squareup.moshi.internal.Util.WildcardTypeImpl
- typeAnnotatedWithAnnotations(Type, Set<? extends Annotation>) - Static method in class com.squareup.moshi.internal.Util
- typeArguments - Variable in class com.squareup.moshi.internal.Util.ParameterizedTypeImpl
- Types - Class in com.squareup.moshi
-
Factory methods for types.
- typesMatch(Type, Type) - Static method in class com.squareup.moshi.internal.Util
U
- unexpectedNull(String, String, JsonReader) - Static method in class com.squareup.moshi.internal.Util
- UNSET_NAME - Static variable in annotation interface com.squareup.moshi.Json
-
The default value of
Json.name()
. - Util - Class in com.squareup.moshi.internal
- Util.GenericArrayTypeImpl - Class in com.squareup.moshi.internal
- Util.ParameterizedTypeImpl - Class in com.squareup.moshi.internal
- Util.WildcardTypeImpl - Class in com.squareup.moshi.internal
-
The WildcardType interface supports multiple upper bounds and multiple lower bounds.
V
- value(boolean) - Method in class com.squareup.moshi.JsonWriter
-
Encodes
value
. - value(double) - Method in class com.squareup.moshi.JsonWriter
-
Encodes
value
. - value(long) - Method in class com.squareup.moshi.JsonWriter
-
Encodes
value
. - value(Boolean) - Method in class com.squareup.moshi.JsonWriter
-
Encodes
value
. - value(Number) - Method in class com.squareup.moshi.JsonWriter
-
Encodes
value
. - value(String) - Method in class com.squareup.moshi.JsonWriter
-
Encodes
value
. - value(BufferedSource) - Method in class com.squareup.moshi.JsonWriter
-
Writes
source
directly without encoding its contents. - valueOf(String) - Static method in enum class com.squareup.moshi.JsonReader.Token
-
Returns the enum constant of this class with the specified name.
- values() - Static method in enum class com.squareup.moshi.JsonReader.Token
-
Returns an array containing the constants of this enum class, in the order they are declared.
- valueSink() - Method in class com.squareup.moshi.JsonWriter
-
Returns a
BufferedSink
into which arbitrary data can be written without any additional encoding.
W
- WildcardTypeImpl(Type[], Type[]) - Constructor for class com.squareup.moshi.internal.Util.WildcardTypeImpl
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form