| Summary: | JSON-P - Marshal to javax.json.JsonObjectBuilder/JsonArrayBuilder | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> | ||||||||||||||||||
| Component: | Eclipselink | Assignee: | Denise Smith <denise.mahar> | ||||||||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||||||||
| Severity: | enhancement | ||||||||||||||||||||
| Priority: | P3 | CC: | eclipselink.oxm-inbox | ||||||||||||||||||
| Version: | unspecified | ||||||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||||||
| Hardware: | PC | ||||||||||||||||||||
| OS: | Mac OS X | ||||||||||||||||||||
| Whiteboard: | |||||||||||||||||||||
| Bug Depends on: | |||||||||||||||||||||
| Bug Blocks: | 405161 | ||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||
|
Description
Blaise Doughan
Created attachment 232906 [details]
Work in progress
Potentially add a method like the following to JsonObjectBuilderResult
public JsonObjectBuilder marshal(Marshaller marshaller, Object object) throws JAXBException {
marshaller.marshal(object, this);
return jsonObjectBuilder;
}
This would let us fit into the JsonObjectBuilder APIs a little neater (compare how the 2nd and 4th phone numbers are added):
JsonObjectBuilderResult result = new JsonObjectBuilderResult(cellPhoneBuilder);
marshaller.marshal(phoneNumber, result);
JsonObject jsonObject = Json.createObjectBuilder()
.add("id", 123)
.add("firstName", "Jane")
.addNull("lastName")
.add("phoneNumbers", Json.createArrayBuilder()
.add(Json.createObjectBuilder()
.add("type", "work")
.add("number", "555-1111")
)
.add(new JsonObjectBuilderResult().marshal(marshaller, phoneNumber))
.add(Json.createObjectBuilder()
.add("type", "home")
.add("number", "555-2222")
)
.add(result.getJsonObjectBuilder())
)
.build();
Created attachment 233631 [details]
Work in progress
Created attachment 233635 [details]
Work in progress
Created attachment 233675 [details]
Proposed changes
Created attachment 233682 [details]
Additional patch
Created attachment 233709 [details]
Additional patch
Created attachment 233732 [details]
Additional update (rename)
Created attachment 233733 [details]
Additional update (rename)
Changes checked in previously but bug wasn't closed. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |