Package com.kosdev.kos.commons.util.json
Class JsonViewWrapper
java.lang.Object
com.kosdev.kos.commons.util.json.JsonViewWrapper
- Direct Known Subclasses:
ReasonData
An object wrapper that applies a custom view to the object being
wrapped. This is commonly used when an object like FutureWork
or Trouble included additional data but that data needs to be
constrained to a view.
- Since:
- 1
- Version:
- 1
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty wrapper object that contains no data or json view.JsonViewWrapper(Object data, Class<?> view) Create a wrapper object that hold the specified data and will serialize the data to json using the specified view class. -
Method Summary
-
Constructor Details
-
JsonViewWrapper
public JsonViewWrapper()Create an empty wrapper object that contains no data or json view.- Since:
- 1
-
JsonViewWrapper
Create a wrapper object that hold the specified data and will serialize the data to json using the specified view class.- Parameters:
data- the data to be serialized to json when the wrapper is serializedview- the json view to apply to the data during serialization- Since:
- 1
-
-
Method Details
-
setData
Convenience method that sets data and view in a single call.- Parameters:
data- the data to be serialized to json when the wrapper is serializedview- the json view to apply to the data during serialization- Since:
- 1
-
getData
-
getView
-
setData
- Returns:
this.
-
setView
- Returns:
this.
-