eclipse-vertx / eclipse-vertx/vertx-codegen
Abstract data object support in params
- Vorherrschende Sprache
- Java
- Sterne
- 111
- Forks
- 89
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.