Compile-Time generation of gson adapters
Go to file
Johannes Frohnmeyer 3ba71463bc
ci/woodpecker/push/woodpecker Pipeline was successful Details
No
2022-11-13 20:04:59 +01:00
gson-compile-annotations No 2022-11-13 20:04:59 +01:00
gson-compile-core No 2022-11-13 20:04:59 +01:00
gson-compile-example No 2022-11-13 20:04:59 +01:00
gson-compile-processor No 2022-11-13 20:04:59 +01:00
.gitignore Support for 1d classes of primitives 2022-10-31 20:52:48 +01:00
.woodpecker.yml Attempt maven publish 2022-11-01 18:09:26 +01:00
LICENSE.md License 2022-11-01 10:15:29 +01:00
README.md Support maps 2022-11-01 21:29:43 +01:00
build.gradle.kts No 2022-11-13 20:04:59 +01:00
settings.gradle.kts Update scripts 2022-11-13 12:38:03 +01:00

README.md

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)

Supported types

  • Primitives (and boxes)
  • Records
  • Nested serializable types
  • Arrays
  • Collections (Sets, Lists, Queues, Deques)
  • java.util.Date as iso8601
  • Enums
  • Maps with string, primitive, enum or UUID keys

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

TODO

  • Support for nested types from libraries
  • Static classes (for configs)

Credit