Interface RoutingConverter<E extends Routing>
- All Known Implementing Classes:
DefaultRoutingConverter
,StaticRoutingConverter
public interface RoutingConverter<E extends Routing>
Specify a JSON converter for a
Constraint
.- Author:
- Fabien Hermenier
-
Method Summary
Modifier and Type Method Description default void
checkId(net.minidev.json.JSONObject o)
Check if the JSON object can be converted using this converter.E
fromJSON(Model mo, net.minidev.json.JSONObject o)
Decode a routing.String
getJSONId()
Get the JSON identifier for the constraint.Class<E>
getSupportedRouting()
Get the name of the constraint that is supported by the converter.net.minidev.json.JSONObject
toJSON(E o)
Serialize a routing.
-
Method Details
-
getSupportedRouting
Get the name of the constraint that is supported by the converter.- Returns:
- The constraint class
-
getJSONId
String getJSONId()Get the JSON identifier for the constraint.- Returns:
- a non-empty string
-
checkId
Check if the JSON object can be converted using this converter. For being convertible, the key 'id' must be equals togetJSONId()
.- Parameters:
o
- the object to test- Throws:
JSONConverterException
- if the object is not compatible
-
fromJSON
Decode a routing.- 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
-
toJSON
Serialize a routing.- Parameters:
o
- the routing to serialize- Returns:
- the conversion result
-