cog
cog copied to clipboard
Create Java code generator
This issue is to track Java builders. The common pattern in Java is to have the builder inside the class, so you can access to the builder doing MyClass.Builder().blah(...).build()
. An example for this pattern is this.
But we are going to do it with some constraints to make it easier:
- All fields and functions are going to be public.
- Java "way" is to use getters/setters, but it does the generator a bit more complex.
- We can add getters/setters at any point if people starts to ask for that.
- Panels don't have a specific builder, they have a "generic" one adding their extra information from
Options
andFieldConfig
, so they aren't going to be inside other class.
Tasks:
- [x] Create (base) types for Java. https://github.com/grafana/cog/pull/207
- [x] Create (base) builders for Java. https://github.com/grafana/cog/pull/355
- [x] Create builders for Panels. https://github.com/grafana/cog/pull/364
- [x] Add defaults in builders. https://github.com/grafana/cog/pull/363
- [x] Make Dataquerys and Panels extensible.
- [x] Error management. https://github.com/grafana/cog/pull/376
- [x] Marshall models properly (We could have names modified because they are reserved keywords)
- [x] Create a veneer to delete extensions when the class doesn't add extra fields. https://github.com/grafana/cog/pull/429
- [ ] Create Java linter in CI
- [ ] Register into Maven to use the library as a dependency for Maven and Gradle.
- Useful information for publishing
- [x] Tests
- Panel Buidlers
- Array/Map references