AutoValue Extension to add Map generation support
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
auto-value-map
gradle/wrapper
.gitignore
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

auto-value-map

AutoValue Extension to add Map generation support. Generates a Map<String,Object> where the keys are the field names and the values the related field values.

Usage

Include the AutoValue: Map Extension in your project and add public abstract Map<String,Object> toMap() to any of your @AutoValue annotated classes.

@AutoValue public abstract class Foo {
  public abstract String bar();
  public abstract Integer bar2();
  public abstract Map<String,Object> toMap();
}

Now build your project and use the generated toMap() method in Foo.

Download

Add a Gradle dependency:

apt 'com.github.cynnyx:auto-value-map:1.0'

(Using the android-apt plugin)

License

Copyright 2016 Cynny

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.