{"id":13472126,"url":"https://github.com/maskarade/StaticGson","last_synced_at":"2025-03-26T15:31:27.363Z","repository":{"id":66138536,"uuid":"53246590","full_name":"maskarade/StaticGson","owner":"maskarade","description":"A Gson binding generator with annotation processing","archived":false,"fork":false,"pushed_at":"2016-12-06T13:28:59.000Z","size":191,"stargazers_count":41,"open_issues_count":2,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-01T16:29:02.290Z","etag":null,"topics":["android","json"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maskarade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-03-06T09:08:45.000Z","updated_at":"2022-06-19T08:09:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"9085acf7-2b62-4201-9c7f-8ef440479d30","html_url":"https://github.com/maskarade/StaticGson","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maskarade%2FStaticGson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maskarade%2FStaticGson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maskarade%2FStaticGson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maskarade%2FStaticGson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maskarade","download_url":"https://codeload.github.com/maskarade/StaticGson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222151628,"owners_count":16939423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","json"],"created_at":"2024-07-31T16:00:52.160Z","updated_at":"2024-10-30T02:31:28.371Z","avatar_url":"https://github.com/maskarade.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Static Gson [![Circle CI](https://circleci.com/gh/gfx/StaticGson.svg?style=svg)](https://circleci.com/gh/gfx/StaticGson) [ ![Download](https://api.bintray.com/packages/gfx/maven/static-gson/images/download.svg) ](https://bintray.com/gfx/maven/static-gson/)\n\nThis library makes [Gson](https://github.com/google/gson) faster by generating `TypeAapterFactory` with annotation processing. In other words, this is an AOT compiler for Gson.\n\n## Getting Started\n\nFor Android apps:\n\n```gradle\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'\n    }\n}\n\napply plugin: 'com.neenbedankt.android-apt'\n\nrepositories {\n    jcenter()\n}\n\n// ...\n\ndependencies {\n    apt 'com.github.gfx.static_gson:static-gson-processor:0.9.8'\n    compile 'com.github.gfx.static_gson:static-gson:0.9.8'\n}\n```\n\nFor Java apps with Gradle 2.12+:\n\n```gradle\ndependencies {\n    compileOnly 'com.github.gfx.static_gson:static-gson-processor:0.9.8'\n    compile 'com.github.gfx.static_gson:static-gson:0.9.8'\n}\n```\n\n## Usage\n\nAdd `@JsonSerializable` to JSON serializable models:\n\n```java\n@JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)\npublic class User {\n    public String firstName; // serialized to \"first_name\"\n    public Stirng lastName; // serialized to \"last_name\"\n}\n```\n\nThen, give `StaticGsonTypeAdapterFactory.newInstance()` to `GsonBuilder`:\n\n```java\nGson gson = new GsonBuilder()\n        .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())\n        .create();\n```\n\nThat's all. `Gson#toJson()` and `Gson#fromGson()` becomes faster\nfor `@JsonSerializable` classes.\n\n## ProGuard\n\nKeep classes generated by the annotation processor.\n\n```proguard\n-keep @com.github.gfx.static_gson.annotation.StaticGsonGenerated class * { *; }\n```\n\n## Benchmark\n\nSee `example/MainActivity.java` for details.\n\nOn Xperia Z4 / Android 5.0.2:\n\n```\n$ adb logcat -v tag | ag D/XXX\n\nD/XXX     : start benchmarking Dynamic Gson\nD/XXX     : Dynamic Gson in serialization: 449ms\nD/XXX     : Dynamic Gson in deserialization: 387ms\nD/XXX     : start benchmarking Static Gson\nD/XXX     : Static Gson in serialization: 198ms\nD/XXX     : Static Gson in deserialization: 233ms\nD/XXX     : start benchmarking Moshi\nD/XXX     : Moshi in serialization: 270ms\nD/XXX     : Moshi in deserialization: 656ms\nD/XXX     : start benchmarking LoganSquare\nD/XXX     : LoganSquare in serialization: 111ms\nD/XXX     : LoganSquare in deserialization: 268ms\n```\n\n## Support\n\n* Use [GitHub issues](https://github.com/gfx/StaticGson/issues) for the issue tracker\n* Feel free to ask for questions to the author [@\\_\\_gfx\\_\\_](https://twitter.com/__gfx__)\n\n## Release Engineering for Maintainers\n\n```shell\n./gradlew bumpMajor # or bumpMinor / bumpPatch\ngit add -va\nmake publish # run tests, build artifacts, publish to jcenter, and make a tag\n```\n\n## Authors\n\nFUJI Goro ([gfx](https://github.com/gfx)).\n\n## License\n\nCopyright (c) 2015 FUJI Goro (gfx).\n\nLicensed 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\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaskarade%2FStaticGson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaskarade%2FStaticGson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaskarade%2FStaticGson/lists"}