Package one.tranic.t.base
Class TBase
java.lang.Object
one.tranic.t.base.TBase
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclose()static Operatorconsole()static @Nullable SystemCommandSource<?,?> Retrieves the console as aSystemCommandSource, an abstraction representing the source of command execution or interaction.static StringgetCurrentRootPackage(Class<?> clazz) Determines the root package for the given class by traversing up one level from the current package name.static StringRetrieves the root path of the current package structure.static CompletableFuture<Void>Executes the givenRunnableasynchronously using a pre-configured executor.static <T> CompletableFuture<T>Executes the given supplier asynchronously using a pre-configured executor.
-
Field Details
-
executor
-
-
Constructor Details
-
TBase
public TBase()
-
-
Method Details
-
getRootPath
Retrieves the root path of the current package structure. This method utilizes thegetCurrentRootPackagemethod to determine the uppermost level of the package hierarchy for theTBaseclass.- Returns:
- the root package path as a
String, representing the highest-level parent package in the hierarchy of theTBaseclass.
-
getCurrentRootPackage
Determines the root package for the given class by traversing up one level from the current package name. If the class is already in the root package, it returns the current package name as is.- Parameters:
clazz- the class whose root package is to be determined- Returns:
- the root package name as a string
-
console
-
getConsoleSource
Retrieves the console as aSystemCommandSource, an abstraction representing the source of command execution or interaction.- Returns:
- a
SystemCommandSourceinstance representing the console source, typically used for administrative or automated command execution.
-
runAsync
Executes the givenRunnableasynchronously using a pre-configured executor.- Parameters:
runnable- theRunnabletask to be executed asynchronously- Returns:
- a
CompletableFuture<Void>that completes once the specified task has been executed
-
runAsync
Executes the given supplier asynchronously using a pre-configured executor.This method is intended for running tasks that return a result in an asynchronous manner.
- Type Parameters:
T- the type of the result produced by the supplier- Parameters:
supplier- theSuppliertask to be executed asynchronously- Returns:
- a
CompletableFuture<T>that completes with the result of the supplier execution
-
close
public static void close()
-