jakartaee / jakartaee/jsonb-api
Configure impl to interface mappings
- Dominant language
- Java
- Stars
- 95
- Forks
- 41
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 35
Description
I have a interface model like:
public interface Customer {
String getName();
Address getAddress();
}
public interface Address {
String getStreet();
String getCity();
}
For each interface there is a single implementation.
Important to note that the model contains nested properties/types using (again) interfaces.
How can this be parsed?
JsonbConfig config = new JsonbConfig()
// TODO: what configuration to add to map interfaces to concrete implementations?
Jsonb jsonb = JsonbBuilder.create(config)
jsonb.fromJson(json, Customer.class);
Above gives exception: `javax.json.bind.JsonbException: interface com.acme.Customer not instantiable`
Note: I cannot change the interfaces nor the concrete implementations as these are provided.
Contributor guide
Research direction
Start with JsonbConfig and the JsonbBuilder.create configuration entry point, then trace jsonb.fromJson(json, Customer.class) for interface instantiation, including the nested Address type. Done means the documented or implemented configuration can map the interfaces to their concrete implementations without changing the provided model classes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100