AutoMoshi processor

An AutoValue extension that supports JSON serialization and deserialization through Moshi.

Лицензия

Лицензия

Категории

Категории

Auto Библиотеки уровня приложения Code Generators Moshi Данные JSON
Группа

Группа

glass.phil.auto.moshi
Идентификатор

Идентификатор

auto-moshi-processor
Последняя версия

Последняя версия

0.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

AutoMoshi processor
An AutoValue extension that supports JSON serialization and deserialization through Moshi.
Ссылка на сайт

Ссылка на сайт

https://github.com/PhilGlass/auto-moshi/
Система контроля версий

Система контроля версий

https://github.com/PhilGlass/auto-moshi/

Скачать auto-moshi-processor

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/glass.phil.auto.moshi/auto-moshi-processor/ -->
<dependency>
    <groupId>glass.phil.auto.moshi</groupId>
    <artifactId>auto-moshi-processor</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/glass.phil.auto.moshi/auto-moshi-processor/
implementation 'glass.phil.auto.moshi:auto-moshi-processor:0.2.0'
// https://jarcasting.com/artifacts/glass.phil.auto.moshi/auto-moshi-processor/
implementation ("glass.phil.auto.moshi:auto-moshi-processor:0.2.0")
'glass.phil.auto.moshi:auto-moshi-processor:jar:0.2.0'
<dependency org="glass.phil.auto.moshi" name="auto-moshi-processor" rev="0.2.0">
  <artifact name="auto-moshi-processor" type="jar" />
</dependency>
@Grapes(
@Grab(group='glass.phil.auto.moshi', module='auto-moshi-processor', version='0.2.0')
)
libraryDependencies += "glass.phil.auto.moshi" % "auto-moshi-processor" % "0.2.0"
[glass.phil.auto.moshi/auto-moshi-processor "0.2.0"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
glass.phil.auto.moshi : auto-moshi-annotations jar 0.2.0
org.jetbrains.kotlin : kotlin-stdlib jar 1.1.2
com.google.auto.value : auto-value jar 1.4
com.squareup.moshi : moshi jar 1.5.0
com.squareup : javapoet jar 1.8.0
com.google.auto : auto-common jar 0.8

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
com.google.testing.compile : compile-testing jar 0.11

Модули Проекта

Данный проект не имеет модулей.

AutoMoshi

An AutoValue extension that supports JSON serialization and deserialization through Moshi.

Usage

To opt in to Moshi support, annotate your AutoValue class with @AutoMoshi:

@AutoValue @AutoMoshi abstract class Foo {
  abstract String a();
}

AutoMoshi will generate a JsonAdapter for each @AutoMoshi annotated class. There is generally no need to reference these generated JsonAdapters directly - instead, create an abstract class that implements JsonAdapter.Factory and annotate it with @AutoMoshi.Factory. AutoMoshi will generate a package-private implementation of this factory class, which should be passed to the builder used to create your Moshi instance:

@AutoMoshi.Factory abstract class AdapterFactory implements JsonAdapter.Factory {
  static JsonAdapter.Factory create() {
    return new AutoMoshi_AdapterFactory();
  }
}
Moshi moshi = new Moshi.Builder().add(AdapterFactory.create()).build();

If your factory class is nested, it must be static and must have at least package visibility. The generated implementation will have a name of the form AutoMoshi_Outer_Middle_Inner, where Inner is the name of your factory class:

class Outer {
  @AutoMoshi.Factory static abstract class InnerAdapterFactory implements JsonAdapter.Factory {
    static JsonAdapter.Factory create() {
      return new AutoMoshi_Outer_InnerAdapterFactory();
    }
  }
}

Download

To use AutoMoshi in an Android project, add the following lines to your build.gradle:

dependencies {
  provided 'glass.phil.auto.moshi:auto-moshi-annotations:0.2.0'
  annotationProcessor 'glass.phil.auto.moshi:auto-moshi-processor:0.2.0'
}

As these artifacts are available only at compile time, an explicit dependency on Moshi is also required:

dependencies {
  compile 'com.squareup.moshi:moshi:1.5.0'
}

Releases are published to Maven Central. Snapshots are published to Sonatype's snapshots repository.

Acknowledgements

This library is heavily influenced by auto-value-moshi.

Версии библиотеки

Версия
0.2.0
0.1.0