Class CreateTimer

java.lang.Object
com.oorian.messaging.commands.Command
com.oorian.messaging.commands.CreateTimer

public class CreateTimer extends Command
Command to create a timer on the client side.

This command creates a timer that can execute callbacks at specified intervals. Timers can be configured as one-shot or periodic, and work in conjunction with the Timer class to provide scheduled execution capabilities.

Features:

  • Creates client-side timers
  • Supports one-shot and periodic timers
  • Configurable interval timing
  • Integrates with Timer objects

Usage:


 // Create a periodic timer that fires every 1000ms
 Timer timer = new Timer("myTimer", 1000, true);
 CreateTimer createCmd = new CreateTimer(timer);
 JsonObject json = createCmd.toJson();
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • CreateTimer

      public CreateTimer(Timer timer)
      Constructs a new CreateTimer command from a Timer object.
      Parameters:
      timer - the Timer instance containing timer configuration
  • Method Details

    • toJson

      public JsonObject toJson()
      Generates the JSON representation of this create timer command.

      The JSON includes the command ID, timer ID, periodic flag, and interval.

      Specified by:
      toJson in class Command
      Returns:
      a JsonObject containing the create timer command attributes