Package dev.runabout
Class RunaboutServiceBuilder<T extends JsonObject>
- java.lang.Object
-
- dev.runabout.RunaboutServiceBuilder<T>
-
- Type Parameters:
T- the type of Json Object to use.
public class RunaboutServiceBuilder<T extends JsonObject> extends java.lang.ObjectA builder for creating a RunaboutService.
-
-
Constructor Summary
Constructors Constructor Description RunaboutServiceBuilder(java.util.function.Supplier<T> jsonFactory)Creates a new RunaboutServiceBuilder with the given JSON object factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RunaboutService<T>build()Builds the RunaboutService.static RunaboutServiceBuilder<JsonObject>getDefaultBuilder()Gets the default RunaboutServiceBuilder instance which uses the built-inJsonObjecttype.RunaboutServiceBuilder<T>setCallerClassBlacklist(java.util.Set<java.lang.Class<?>> callerClassBlacklist)Sets the caller class blacklist for the RunaboutService.RunaboutServiceBuilder<T>setCallerSupplier(java.util.function.Supplier<java.lang.reflect.Method> callerSupplier)Sets the caller supplier for the RunaboutService.RunaboutServiceBuilder<T>setCustomSerializer(RunaboutSerializer customSerializer)Sets the custom serializer for the RunaboutService.RunaboutServiceBuilder<T>setDatetimeSupplier(java.util.function.Supplier<java.lang.String> datetimeSupplier)Sets the datetime supplier for the RunaboutService.RunaboutServiceBuilder<T>setExcludeSuper(boolean excludeSuper)Sets whether the RunaboutService should not be able to invoke instance serializer methods annotated withToRunaboutfrom superclasses.RunaboutServiceBuilder<T>setThrowableConsumer(java.util.function.Consumer<java.lang.Throwable> throwableConsumer)Sets a consumer for any throwables that occur during the RunaboutService's operation.
-
-
-
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-inJsonObjecttype.- 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, theRunaboutServicewill useDefaultCallerSupplier.- Parameters:
callerSupplier- A supplier that returns the desiredMethodto 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 withsetCallerSupplier(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 theRunaboutSerializerservice 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 withToRunaboutfrom 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 usingInstant.now().- Parameters:
datetimeSupplier- The datetime supplier.- Returns:
- The RunaboutServiceBuilder.
-
build
public RunaboutService<T> build()
Builds the RunaboutService.- Returns:
- The RunaboutService.
-
-