Package org.eclipse.rap.rwt.remote
Class JsonMapping
java.lang.Object
org.eclipse.rap.rwt.remote.JsonMapping
Provides utility methods that map common SWT types to their JSON representations used in the RAP
 protocol and back.
- Since:
- 2.3
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionstatic PointReturns an instance of Point for the given JSON representation.static RectanglereadRectangle(JsonValue value) Returns an instance of Rectangle for the given JSON representation.static RGBReturns an instance of RGB for the given JSON representation.static JsonValueReturns the JSON representation for the given Color.static JsonValueReturns the JSON representation for the given Color with an additional alpha (opacity) value.static JsonValueReturns the JSON representation for the given Cursor.static JsonValueReturns the JSON representation for the given Font.static JsonValueReturns the JSON representation for the given FontData.static JsonValueReturns the JSON representation for the given Image.static JsonValueReturns the JSON representation for the given Point.static JsonValueReturns the JSON representation for the given array Point.static JsonValueReturns the JSON representation for the given Rectangle.static JsonValueReturns the JSON representation for the given RGB.static JsonValueReturns the JSON representation for the given RGB with an additional alpha (opacity) value.static JsonValueReturns the JSON representation for the given Widget.static JsonValueReturns the JSON representation for the given array of widgets.
- 
Method Details- 
toJsonReturns the JSON representation for the given Widget. This method acceptsnull, which will be mapped toJsonValue.NULL. Disposed widgets cannot be mapped to JSON.- Parameters:
- widget- the widget to encode or- null, must not be disposed
- Returns:
- a JSON value that represents the given widget
 
- 
toJsonReturns the JSON representation for the given array of widgets. The array must not contain disposed widgets, as those cannot be mapped to JSON.- Parameters:
- widgets- the array of widgets to encode, must not be- null
- Returns:
- a JSON value that represents the given widget array
- Since:
- 3.1
 
- 
toJsonReturns the JSON representation for the given Point. This method acceptsnull, which will be mapped toJsonValue.NULL.- Parameters:
- point- the Point to encode or- null
- Returns:
- a JSON value that represents the given point
 
- 
toJsonReturns the JSON representation for the given array Point. This method acceptsnull, which will be mapped toJsonValue.NULL.- Parameters:
- points- the array Point to encode or- null
- Returns:
- a JSON value that represents the given point
- Since:
- 3.13
 
- 
toJsonReturns the JSON representation for the given Rectangle. This method acceptsnull, which will be mapped toJsonValue.NULL.- Parameters:
- rect- the Rectangle to encode or- null
- Returns:
- a JSON value that represents the given rectangle
 
- 
toJsonReturns the JSON representation for the given Color. This method acceptsnull, which will be mapped toJsonValue.NULL. Disposed colors cannot be mapped to JSON.- Parameters:
- color- the Color to encode or- null, must not be disposed
- Returns:
- a JSON value that represents the given color
 
- 
toJsonReturns the JSON representation for the given Color with an additional alpha (opacity) value. This method acceptsnull, which will be mapped toJsonValue.NULLregardless of the given alpha value. Disposed colors cannot be mapped to JSON.- Parameters:
- color- the Color to encode or- null, must not be disposed
- alpha- a value in the range of 0 (transparent) to 255 (opaque)
- Returns:
- a JSON value that represents the given color
 
- 
toJsonReturns the JSON representation for the given RGB. This method acceptsnull, which will be mapped toJsonValue.NULL.- Parameters:
- rgb- the Color to encode or- null
- Returns:
- a JSON value that represents the given color
 
- 
toJsonReturns the JSON representation for the given RGB with an additional alpha (opacity) value. This method acceptsnull, which will be mapped toJsonValue.NULLregardless of the given alpha value.- Parameters:
- rgb- the RGB to encode or- null
- alpha- a value in the range of 0 (transparent) to 255 (opaque)
- Returns:
- a JSON value that represents the given rgb
 
- 
toJsonReturns the JSON representation for the given Image. This method acceptsnull, which will be mapped toJsonValue.NULL. Disposed images cannot be mapped to JSON.- Parameters:
- image- the Image to encode or- null, must not be disposed
- Returns:
- a JSON value that represents the given rgb
 
- 
toJsonReturns the JSON representation for the given Font. This method acceptsnull, which will be mapped toJsonValue.NULL. Disposed fonts cannot be mapped to JSON.- Parameters:
- font- the Font to encode or- null, must not be disposed
- Returns:
- a JSON value that represents the given font
 
- 
toJsonReturns the JSON representation for the given FontData. This method acceptsnull, which will be mapped toJsonValue.NULL.- Parameters:
- fontData- the FontData to encode or- null
- Returns:
- a JSON value that represents the given font data
 
- 
toJsonReturns the JSON representation for the given Cursor. This method acceptsnull, which will be mapped toJsonValue.NULL.- Parameters:
- cursor- the Cursor to encode or- null
- Returns:
- a JSON value that represents the given cursor
- Since:
- 3.1
 
- 
readPointReturns an instance of Point for the given JSON representation. This method returnsnullif the given JSON value isJsonValue.NULL.- Parameters:
- value- a JsonValue that represents a point or- JsonValue.NULL
- Returns:
- a Point that corresponds to the given JSON value or null
 
- 
readRectangleReturns an instance of Rectangle for the given JSON representation. This method returnsnullif the given JSON value isJsonValue.NULL.- Parameters:
- value- a JsonValue that represents a rectangle or- JsonValue.NULL
- Returns:
- a Rectangle that corresponds to the given JSON value or null
 
- 
readRGBReturns an instance of RGB for the given JSON representation. This method returnsnullif the given JSON value isJsonValue.NULL.- Parameters:
- value- a JsonValue that represents a color or- JsonValue.NULL
- Returns:
- an RGB that corresponds to the given JSON value or null
 
 
-