Interface JsonEngine
-
- All Superinterfaces:
io.vertigo.core.node.component.Component
,io.vertigo.core.node.component.CoreComponent
- All Known Implementing Classes:
GoogleJsonEngine
public interface JsonEngine extends io.vertigo.core.node.component.Component
Convert Object to Json, and json to Object. Support : - Exception - exclude fields - Security token - UiObject (contains a DtObject buffer and security token if present)- Author:
- npiedeloup (17 juil. 2014 11:56:17)
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXTENDED_VALUE_FIELDNAME
list value fieldname.static String
SERVER_SIDE_TOKEN_FIELDNAME
server side token fieldname.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <D> D
fromJson(Reader jsonReader, Type paramType)
Standard convert Json to object.<D> D
fromJson(String json, Type paramType)
Standard convert Json to object.String
toJson(Object data)
Standard convert full object to Json.String
toJsonError(Throwable th)
Convert Exception to JsonString
toJsonWithMeta(Object data, Map<String,Serializable> metaDatas, Set<String> includedFields, Set<String> excludedFields)
Convert object to Json but excluded fields.UiContext
uiContextFromJson(String json, Map<String,Type> paramTypes)
Specific convertion Json to UiContext.<D extends DtObject>
UiListDelta<D>uiListDeltaFromJson(String json, Type paramType)
Specific convertion Json to UiListDelta.<D extends DtObject>
UiListModifiable<D>uiListFromJson(String json, Type paramType)
Specific convertion Json to UiList.<D extends DtObject>
UiObject<D>uiObjectFromJson(String json, Type paramType)
Specific convertion Json to UiObject.
-
-
-
Field Detail
-
EXTENDED_VALUE_FIELDNAME
static final String EXTENDED_VALUE_FIELDNAME
list value fieldname.- See Also:
- Constant Field Values
-
SERVER_SIDE_TOKEN_FIELDNAME
static final String SERVER_SIDE_TOKEN_FIELDNAME
server side token fieldname.- See Also:
- Constant Field Values
-
-
Method Detail
-
toJson
String toJson(Object data)
Standard convert full object to Json.- Parameters:
data
- Object- Returns:
- Json string
-
toJsonError
String toJsonError(Throwable th)
Convert Exception to Json- Parameters:
th
- Throwable- Returns:
- Json string
-
toJsonWithMeta
String toJsonWithMeta(Object data, Map<String,Serializable> metaDatas, Set<String> includedFields, Set<String> excludedFields)
Convert object to Json but excluded fields.- Parameters:
data
- ObjectmetaDatas
- metaDatas to include in JsonincludedFields
- Set of fields to include (empty means all fields include)excludedFields
- Set of fields to exclude- Returns:
- Json string
-
fromJson
<D> D fromJson(String json, Type paramType)
Standard convert Json to object. While converting accept missing object fields and unknown object fields (and then just forgot json value)- Type Parameters:
D
- Object type- Parameters:
json
- Json stringparamType
- Object type- Returns:
- Object filled with json typed data
-
fromJson
<D> D fromJson(Reader jsonReader, Type paramType)
Standard convert Json to object. While converting accept missing object fields and unknown object fields (and then just forgot json value)- Type Parameters:
D
- Object type- Parameters:
jsonReader
- ReaderparamType
- Object type- Returns:
- Object filled with json typed data
-
uiObjectFromJson
<D extends DtObject> UiObject<D> uiObjectFromJson(String json, Type paramType)
Specific convertion Json to UiObject. UiObject is used as a buffer from client input. While converting accept missing object fields and unknown object fields (and then just forgot json value)- Type Parameters:
D
- Object type- Parameters:
json
- Json stringparamType
- Object type- Returns:
- UiObject filled with a DtObject partially filled and the accessToken if present
-
uiContextFromJson
UiContext uiContextFromJson(String json, Map<String,Type> paramTypes)
Specific convertion Json to UiContext. UiContext is used as a buffer from client input- Parameters:
json
- Json stringparamTypes
- Objects type- Returns:
- UiContext filled with a DtObject partially filled and the accessTOken if present
-
uiListDeltaFromJson
<D extends DtObject> UiListDelta<D> uiListDeltaFromJson(String json, Type paramType)
Specific convertion Json to UiListDelta.- Type Parameters:
D
- Object type- Parameters:
json
- Json stringparamType
- Object type- Returns:
- UiListDelta filled with created/updated/deleted DtObjects list partially filled and the accessToken if present
-
uiListFromJson
<D extends DtObject> UiListModifiable<D> uiListFromJson(String json, Type paramType)
Specific convertion Json to UiList.- Type Parameters:
D
- Object type- Parameters:
json
- Json stringparamType
- Object type- Returns:
- UiList filled with DtObjects list partially filled and the accessToken if present
-
-