Package org.dmfs.express.json.elementary
Class DelegatingJsonValue
- java.lang.Object
-
- org.dmfs.express.json.elementary.DelegatingJsonValue
-
- All Implemented Interfaces:
JsonValue
public abstract class DelegatingJsonValue extends java.lang.Object implements JsonValue
An abstractJsonValueobject 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
JsonValueObjects orArrays 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
JsonValueobject:new Person("John", "Doe", 23)
-
-
Constructor Summary
Constructors Constructor Description DelegatingJsonValue(JsonValue delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidserialize(JsonSink jsonSink)
-