yongjhih / autojson Goto Github PK
View Code? Open in Web Editor NEWAutoLoganSquare = AutoValue + LoganSquare
License: Apache License 2.0
AutoLoganSquare = AutoValue + LoganSquare
License: Apache License 2.0
AutoJson generates and duplicates a TypeConverter.
I have a custom TypeConverter for a Map. AutoJson generates another one.
Example:
@AutoJson
public abstract class Person implements Parcelable {
@Nullable
@AutoJson.Field
public abstract String name();
@Nullable
@AutoJson.Field
public abstract List<Image> images();
public static Builder builder() {
return new AutoJson_Person.Builder();
}
@AutoJson.Builder
public abstract static class Builder {
public abstract Builder name(String name);
public abstract Builder images(List<Image> images);
public abstract Person build();
}
}
@AutoJson
public abstract class Image {
@NonNull
@AutoJson.Field
public abstract String url();
@NonNull
@AutoJson.Field
public abstract float size();
public static Builder builder() {
return new AutoJson_Image.Builder();
}
@AutoJson.Builder
public abstract static class Builder {
public abstract Builder url(String url);
public abstract Builder size(float size);
public abstract Image build();
}
}
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Can we have an AutoJson format for all Json libraries for models ?
@AutoJson(format = "gson")
@AutoJson(format = "logan")
@AutoJson(format = "jackson")
For instance
@AutoJson(format = "gson")
abstract class Person {
...
@AutoJson.Field(name = "name")
public abstract String name();
....
}
will become
public class AutoJson_Person extends Person {
...
@com.gson.SerializedName(name = "name)
String name;
...
}
Similarly for all the json formats. This will save a lot of time for people who want to just change how they use Json libraries.
It is currently a pain to switching json parsing libraries.
Adding a json parsing library will depend on the user and this library will be very light weight.
Open to any discussion regarding this.
I use auto-json v1.0.2 and logansquare v1.1.0.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/26592016-incorrect-generation-of-converters-for-nested-classes?utm_campaign=plugin&utm_content=tracker%2F19623266&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F19623266&utm_medium=issues&utm_source=github).A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.