Class StaticRoutingConverter
java.lang.Object
org.btrplace.json.model.view.network.StaticRoutingConverter
- All Implemented Interfaces:
RoutingConverter<StaticRouting>
public class StaticRoutingConverter extends Object implements RoutingConverter<StaticRouting>
A converter to (un-)serialise a
StaticRouting
.
All the routes are serialized.
- Author:
- Fabien Hermenier
-
Field Summary
Fields Modifier and Type Field Description static String
ROUTES_LABEL
-
Constructor Summary
Constructors Constructor Description StaticRoutingConverter()
-
Method Summary
Modifier and Type Method Description StaticRouting
fromJSON(Model mo, net.minidev.json.JSONObject o)
Decode a routing.String
getJSONId()
Return the routing identifier.Class<StaticRouting>
getSupportedRouting()
Get the name of the constraint that is supported by the converter.StaticRouting.NodesMap
nodesMapFromJSON(Model mo, net.minidev.json.JSONObject o)
Convert a JSON nodes map object into a Java NodesMap objectnet.minidev.json.JSONObject
nodesMapToJSON(StaticRouting.NodesMap nm)
Convert a nodes map (a pair of two distinguishable nodes to source and destination) into a JSON objectnet.minidev.json.JSONObject
toJSON(StaticRouting routing)
Convert a Routing implementation into a JSON object
-
Field Details
-
ROUTES_LABEL
- See Also:
- Constant Field Values
-
-
Constructor Details
-
StaticRoutingConverter
public StaticRoutingConverter()
-
-
Method Details
-
getSupportedRouting
Description copied from interface:RoutingConverter
Get the name of the constraint that is supported by the converter.- Specified by:
getSupportedRouting
in interfaceRoutingConverter<StaticRouting>
- Returns:
- The constraint class
-
getJSONId
Return the routing identifier.- Specified by:
getJSONId
in interfaceRoutingConverter<StaticRouting>
- Returns:
"static"
-
fromJSON
public StaticRouting fromJSON(Model mo, net.minidev.json.JSONObject o) throws JSONConverterExceptionDescription copied from interface:RoutingConverter
Decode a routing.- Specified by:
fromJSON
in interfaceRoutingConverter<StaticRouting>
- Parameters:
mo
- the model to rely ono
- the routing to decode- Returns:
- the conversion result
- Throws:
JSONConverterException
- if an error occurred while decoding the routing
-
nodesMapFromJSON
public StaticRouting.NodesMap nodesMapFromJSON(Model mo, net.minidev.json.JSONObject o) throws JSONConverterExceptionConvert a JSON nodes map object into a Java NodesMap object- Parameters:
mo
- the model we focus ono
- the JSON object to convert- Returns:
- the nodes map
- Throws:
JSONConverterException
- if a error occurred during the conversion
-
nodesMapToJSON
Convert a nodes map (a pair of two distinguishable nodes to source and destination) into a JSON object- Parameters:
nm
- the nodes map to convert- Returns:
- the nodes map JSON object
-
toJSON
Convert a Routing implementation into a JSON object- Specified by:
toJSON
in interfaceRoutingConverter<StaticRouting>
- Parameters:
routing
- the routing implementation to convert- Returns:
- the JSON formatted routing object
-