Class DelegatingJsonValue

java.lang.Object
org.dmfs.express.json.elementary.DelegatingJsonValue
All Implemented Interfaces:
JsonValue

public abstract class DelegatingJsonValue extends Object implements JsonValue
An abstract JsonValue object which just delegates to another JsonValue object. It's meant to fix the lack of native support for the delagate pattern in Java.

You can use it to compose complex JsonValue Objects or Arrays and give the result a proper name.

Example


 public final class Person extends DelegatingJsonValue
 {
     public Person(String firstName, String lastName, int age)
     {
         super(new Object(
             new Member("@class", "person"),
             new Member("firstname", firstName),
             new Member("lastname", lastName),
             new Member("age", age)));
     }
 }
 

The following code results in a valid a valid JsonValue object:

new Person("John", "Doe", 23)