Package dev.runabout

Class RunaboutServiceBuilder<T extends JsonObject>

  • Type Parameters:
    T - the type of Json Object to use.

    public class RunaboutServiceBuilder<T extends JsonObject>
    extends java.lang.Object
    A builder for creating a RunaboutService.
    • Constructor Detail

      • RunaboutServiceBuilder

        public RunaboutServiceBuilder​(java.util.function.Supplier<T> jsonFactory)
        Creates a new RunaboutServiceBuilder with the given JSON object factory. The supplier should create new instances of JSON objects.
        Parameters:
        jsonFactory - The JSON object factory.
    • Method Detail

      • getDefaultBuilder

        public static RunaboutServiceBuilder<JsonObject> getDefaultBuilder()
        Gets the default RunaboutServiceBuilder instance which uses the built-in JsonObject type.
        Returns:
        The default RunaboutServiceBuilder.
      • setCallerSupplier

        public RunaboutServiceBuilder<T> setCallerSupplier​(java.util.function.Supplier<java.lang.reflect.Method> callerSupplier)
        Sets the caller supplier for the RunaboutService. The supplier should return the desired method for Runabout replay debugging from the stack a runtime. By default, the RunaboutService will use DefaultCallerSupplier.
        Parameters:
        callerSupplier - A supplier that returns the desired Method to include in the Runabout JSON.
        Returns:
        The RunaboutServiceBuilder.
      • setCallerClassBlacklist

        public RunaboutServiceBuilder<T> setCallerClassBlacklist​(java.util.Set<java.lang.Class<?>> callerClassBlacklist)
        Sets the caller class blacklist for the RunaboutService. The blacklist is used to filter out classes from the stack trace that should not be included in the Runabout JSON. This method is mutually exclusive with setCallerSupplier(Supplier). By default, the blacklist is empty.
        Parameters:
        callerClassBlacklist - The set of classes to blacklist from the stack trace.
        Returns:
        The RunaboutServiceBuilder.
      • setCustomSerializer

        public RunaboutServiceBuilder<T> setCustomSerializer​(RunaboutSerializer customSerializer)
        Sets the custom serializer for the RunaboutService. The serializer is used to serialize objects that do not have an instance serializer method. This serializer instance is not the default serializer, but a custom one. By default, the serializer the first instance of the RunaboutSerializer service discovered via the ServiceLoader.
        Parameters:
        customSerializer - The custom serializer to use.
        Returns:
        The RunaboutServiceBuilder.
      • setThrowableConsumer

        public RunaboutServiceBuilder<T> setThrowableConsumer​(java.util.function.Consumer<java.lang.Throwable> throwableConsumer)
        Sets a consumer for any throwables that occur during the RunaboutService's operation. By default, the service will not throw exceptions, but will throw errors.
        Parameters:
        throwableConsumer - a consumer
        Returns:
        The RunaboutServiceBuilder.
      • setExcludeSuper

        public RunaboutServiceBuilder<T> setExcludeSuper​(boolean excludeSuper)
        Sets whether the RunaboutService should not be able to invoke instance serializer methods annotated with ToRunabout from superclasses. By default, the service will not exclude super classes' instance serializer methods.
        Parameters:
        excludeSuper - Whether the service should exclude super classes.
        Returns:
        The RunaboutServiceBuilder.
      • setDatetimeSupplier

        public RunaboutServiceBuilder<T> setDatetimeSupplier​(java.util.function.Supplier<java.lang.String> datetimeSupplier)
        Sets the datetime supplier for the RunaboutService. The supplier should return the current datetime UTC as an ISO-8601 formatted string. By default, the supplier will return the current datetime using Instant.now().
        Parameters:
        datetimeSupplier - The datetime supplier.
        Returns:
        The RunaboutServiceBuilder.
      • build

        public RunaboutService<T> build()
        Builds the RunaboutService.
        Returns:
        The RunaboutService.