Package dev.runabout
Interface RunaboutService<T extends JsonObject>
-
- Type Parameters:
T- The type of JSON object to use.
public interface RunaboutService<T extends JsonObject>Runabout interface for converting runtime java objects to JSON outputs that can be used for replay debugging in Runabout. The service has a generic type parameter that allows for the user to specify the type of JSON object to be used. By default, the service uses the built-in lightweightJsonObjectinterface. To use a different type, useRunaboutServiceBuilderto create a custom service.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.reflect.MethodgetCallerMethod()Finds the closest caller method the stack that does not come from the Runabout library.static RunaboutService<JsonObject>getService()Gets the default RunaboutService which uses the built-inJsonObjecttype.RunaboutInputserialize(java.lang.Object object)Converts an object to a RunaboutInput.default TtoRunaboutJson(java.lang.Object... objects)Converts a set of objects to a Runabout JSON object.TtoRunaboutJson(java.lang.reflect.Method method, java.lang.Object... objects)Converts a method and the given objects to a Runabout JSON object.default java.lang.StringtoRunaboutString(java.lang.Object... objects)Converts a set of objects to a Runabout JSON string.default java.lang.StringtoRunaboutString(java.lang.reflect.Method method, java.lang.Object... objects)Converts a Method and set of objects to a Runabout JSON string.
-
-
-
Method Detail
-
getService
static RunaboutService<JsonObject> getService()
Gets the default RunaboutService which uses the built-inJsonObjecttype.- Returns:
- A default RunaboutService.
-
serialize
RunaboutInput serialize(java.lang.Object object)
Converts an object to a RunaboutInput.- Parameters:
object- The object to serialize.- Returns:
- A RunaboutInput representing the serialized object.
-
getCallerMethod
java.lang.reflect.Method getCallerMethod()
Finds the closest caller method the stack that does not come from the Runabout library.- Returns:
- The caller method.
-
toRunaboutJson
default T toRunaboutJson(java.lang.Object... objects)
Converts a set of objects to a Runabout JSON object. Info about the caller method is implicitly determined. SeetoRunaboutJson(Method, Object...)for more info.- Parameters:
objects- The objects to convert to Runabout inputs in JSON.- Returns:
- A JSON object.
-
toRunaboutJson
T toRunaboutJson(java.lang.reflect.Method method, java.lang.Object... objects)
Converts a method and the given objects to a Runabout JSON object. This JSON format is known by Runabout and can be parsed by the Runabout web application and IDE plugin. The format is as follows:{
"version": "0.0.0", // The version of the Runabout JSON format.
"caller": "com.example.ClassName.methodName", // The caller method, from which the objects are arguments.
"inputs": [] // The runabout inputs (as JSON) from the objects passed in.
}
The format of the inputs is as follows:{
"type": "com.example.Value", // The fully qualified class of the input.
"value": "new Value()" // A String which is a Java expression, which evaluates to an object.
"dependencies": [] // The fully qualified class names for all dependencies of the input.
}- Parameters:
method- The method that the objects are arguments for.objects- The objects to convert to Runabout inputs in JSON.- Returns:
- A JSON object.
-
toRunaboutString
default java.lang.String toRunaboutString(java.lang.Object... objects)
Converts a set of objects to a Runabout JSON string. SeetoRunaboutJson(Object...)for more info.- Parameters:
objects- The objects to convert to Runabout inputs in JSON.- Returns:
- A JSON object as a String.
-
toRunaboutString
default java.lang.String toRunaboutString(java.lang.reflect.Method method, java.lang.Object... objects)Converts a Method and set of objects to a Runabout JSON string. SeetoRunaboutJson(Object...)for more info.- Parameters:
method- The method that the objects are arguments for.objects- The objects to convert to Runabout inputs in JSON.- Returns:
- A JSON object as a String.
-
-