Skip to content

nename0/moshi-java-codegen

Repository files navigation

moshi-java-codegen

This annotation processor generates small and fast JsonAdapters for Moshi from Java classes, just like the moshi-kotlin-codegen for Kotlin. To use it just annotate your class like this:

@JsonClass(generateAdapter = true, generator = "java")
class BlackjackHand {
  public final Card hidden_card;
  public final List<Card> visible_cards;
  ...
}

and add the annotation processor to your project. For Gradle:

repositories {
    mavenCentral()
    maven { url 'https://jitpack.io' }
    ...
}

dependencies {
    annotationProcessor "com.github.nename0:moshi-java-codegen:1.1.1" 
}

License

The source code is based on:



Copyright 2015 BlueLine Labs, Inc.
Copyright (C) 2018 Square, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.