public class

PersistJSON

extends Object
java.lang.Object
   ↳ com.datalogic.extension.selfshopping.led.action.persistence.PersistJSON

Class Overview

Helper class to allow persisting LedAction objects to the JSON format. The same operation is also available through reflection by using a classic JSON library (such as Google GSON).

Summary

Public Constructors
PersistJSON()
Public Methods
static LedAction fromJson(String json)
Converts a JSON string into a LedAction.
static String toJson(LedAction action)
Converts a LedAction into a JSON string.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PersistJSON ()

Added in revision 2

Public Methods

public static LedAction fromJson (String json)

Added in revision 2

Converts a JSON string into a LedAction. This is done taking into consideration all the JSON attributes present in the string to generate the resulting object. If there are wrong or missing attributes the operation will fail by returning null.

Parameters
json The input JSON string.
Returns
  • The resulting LedAction if the conversion succeeds, null otherwise.

public static String toJson (LedAction action)

Added in revision 2

Converts a LedAction into a JSON string. This is done taking into consideration all the internal variables composing the object and making them available in the resulting string. If the input object cannot be converted to JSON, a null string will be returned.

Parameters
action The input LedAction.
Returns
  • String The resulting JSON String if the conversion succeeds, null otherwise.