eclipse-vertx / eclipse-vertx/vertx-codegen

Abstract data object support in params

Open
#80 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
111
Forks
89
PR merge metrics
No merged PRs in 30d

Description

Data object params needs to be a plain class because it needs to be reconstructed from Json format (for example in JavaScript or Groovy). This is now not possible because the code generator will not know which data object to create.

We could work around this by having a static method `fromJson` returning an instance of that object that would be invoked by the generator, delegating the responsibility of creating the right instance to this method. This method could either use some hard coded mechanism or something else.

For example:

```
@DataObject
public abstract class AuthOptions {
public static AuthOptions fromJson(JsonObject object) {
...
}
}
```

This would allow for example the use of a common data object in service proxies or configuration.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.