gson-compile/README.md

42 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

# Gson-Compile
A java annotation processor implementing automated type adapter generation for gson-comments.
The goal of this AP is to
- Support common features such as getters, setters, fields, constructors
- Support modern language features such as records
- Support json5 through gson-comments
- Be compile-time where possible (ideally compatible with proguard)
2022-11-01 16:47:00 +01:00
## Supported types
- Primitives (and boxes)
2022-11-01 11:50:02 +01:00
- Records
- Nested serializable types
2022-11-01 13:48:23 +01:00
- Arrays
2022-11-01 15:08:02 +01:00
- Collections (Sets, Lists, Queues, Deques)
2022-11-01 16:58:16 +01:00
- java.util.Date as iso8601
2022-11-01 17:26:32 +01:00
- Enums
2022-11-01 21:29:43 +01:00
- Maps with string, primitive, enum or UUID keys
2022-11-01 16:47:00 +01:00
## Used properties
Use `@GPrefer` to choose one construction method if multiple are available
- Builders (referenced in `@GSerializable`)
- Factory functions
- Constructors
- Getters/Setters
- Direct fields (public non-static only)
## Additional features
- Support for generating Gson adapters to hook into the gson system
- Optional, strict no-reflection enforcement via `-AgsonCompileNoReflect`
- Comments via `@GComment`
- Several utility methods in the generated class for reading from/writing to various sources
2022-11-24 19:44:20 +01:00
- Support for generating extension methods if manifold is present
## TODO
- Support for nested types from libraries
- Static classes (for configs)
2022-11-01 10:15:29 +01:00
## Credit
2022-11-01 18:09:26 +01:00
- The Gson-Compile processor is based on [gsonvalue](https://github.com/evant/gsonvalue) and [value-processor](https://github.com/evant/value-processor) by Eva Tatarka.
- The API was inspired by [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization) by Jetbrains
- The serialization is powered by [my fork](https://gitlab.com/JFronny/gson-comments) of [gson](https://github.com/google/gson) by Google