Class CommandContext.ArgumentTiming

java.lang.Object
cloud.commandframework.context.CommandContext.ArgumentTiming
Enclosing class:
CommandContext<C>

@API(status=STABLE) public static final class CommandContext.ArgumentTiming extends Object
Used to track performance metrics related to command parsing. This is attached to the command context, as this depends on the command context that is being parsed.

The times are measured in nanoseconds.

  • Constructor Details

    • ArgumentTiming

      public ArgumentTiming(long start, long end, boolean success)
      Created a new argument timing instance
      Parameters:
      start - Start time (in nanoseconds)
      end - End time (in nanoseconds)
      success - Whether the argument was parsed successfully
    • ArgumentTiming

      public ArgumentTiming(long start)
      Created a new argument timing instance without an end time
      Parameters:
      start - Start time (in nanoseconds)
    • ArgumentTiming

      public ArgumentTiming()
      Created a new argument timing instance
  • Method Details

    • getElapsedTime

      public long getElapsedTime()
      Get the elapsed time
      Returns:
      Elapsed time (in nanoseconds)
    • setEnd

      public void setEnd(long end, boolean success)
      Set the end time
      Parameters:
      end - End time (in nanoseconds)
      success - Whether the argument was parsed successfully
    • setStart

      public void setStart(long start)
      Set the start time
      Parameters:
      start - Start time (in nanoseconds)
    • wasSuccess

      public boolean wasSuccess()
      Check whether the value was parsed successfully
      Returns:
      true if the value was parsed successfully, false if not