Class TBase

java.lang.Object
one.tranic.t.base.TBase

public class TBase extends Object
  • Field Details

  • Constructor Details

    • TBase

      public TBase()
  • Method Details

    • getRootPath

      public static String getRootPath()
      Retrieves the root path of the current package structure. This method utilizes the getCurrentRootPackage method to determine the uppermost level of the package hierarchy for the TBase class.
      Returns:
      the root package path as a String, representing the highest-level parent package in the hierarchy of the TBase class.
    • getCurrentRootPackage

      public static String getCurrentRootPackage(Class<?> clazz)
      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

      public static Operator console()
    • getConsoleSource

      @Nullable public static @Nullable SystemCommandSource<?,?> getConsoleSource()
      Retrieves the console as a SystemCommandSource, an abstraction representing the source of command execution or interaction.
      Returns:
      a SystemCommandSource instance representing the console source, typically used for administrative or automated command execution.
    • runAsync

      public static CompletableFuture<Void> runAsync(Runnable runnable)
      Executes the given Runnable asynchronously using a pre-configured executor.
      Parameters:
      runnable - the Runnable task to be executed asynchronously
      Returns:
      a CompletableFuture<Void> that completes once the specified task has been executed
    • runAsync

      public static <T> CompletableFuture<T> runAsync(Supplier<T> supplier)
      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 - the Supplier task to be executed asynchronously
      Returns:
      a CompletableFuture<T> that completes with the result of the supplier execution
    • close

      public static void close()