commit | eaebfcbbc929394d534848b664e2a66118713492 | [log] [tgz] |
---|---|---|
author | Andrew Guibert <andy.guibert@gmail.com> | Fri Nov 24 21:14:03 2017 -0600 |
committer | Andrew Guibert <andy.guibert@gmail.com> | Fri Nov 24 21:14:03 2017 -0600 |
tree | dd7acd61ad6548d9ec1274582b7ebcba3d866246 | |
parent | bde9d992bd7741a7a829e196a0309f0d80d65eb9 [diff] |
Ignore property methods with incorrect num args Previously we assumed that if a method started with "get" or "is" that it had 0 arguments. Likewise we assumed that if a method started with "set" it had exactly 1 argument. These unchecked assumptions cause IllegalStateExceptions later on in execution, and impose unnecessary constraints on method signatures of JSON-B model classes. Signed-off-by: Andrew Guibert <andy.guibert@gmail.com>
Yasson is a Java framework which provides a standard binding layer between Java classes and JSON documents. This is similar to what JAXB is doing in the XML world. Yasson is an official reference implementation of JSON Binding (JSR-367).
It defines a default mapping algorithm for converting existing Java classes to JSON suitable for the most cases:
Jsonb jsonb = JsonbBuilder.create(); String result = jsonb.toJson(someObject);
For whom it's not enough it provides rich customization abilities through a set of annotations and rich programmatic API:
// Create custom configuration JsonbConfig config = new JsonbConfig() .withNullValues(true) .withFormating(true); // Create Jsonb with custom configuration Jsonb jsonb = JsonbBuilder.create(config); // Use it! String result = jsonb.toJson(someObject);