Enum Class Triggers

java.lang.Object
java.lang.Enum<Triggers>
dev.gmitch215.bytebox.gradle.Triggers
All Implemented Interfaces:
Serializable, Comparable<Triggers>, Constable

public enum Triggers extends Enum<Triggers>
Which triggers a handler class handles.

Read from the class itself rather than declared twice. A Worker implements one interface per trigger, so the interfaces it implements are already the answer, and asking the class means a configuration cannot drift from the code.

Since:
1.0.0
  • Enum Constant Details

    • FETCH

      public static final Triggers FETCH
      HTTP requests.
    • SCHEDULED

      public static final Triggers SCHEDULED
      Cron Triggers.
    • EMAIL

      public static final Triggers EMAIL
      Incoming email.
    • QUEUE

      public static final Triggers QUEUE
      Queue batches.
    • TAIL

      public static final Triggers TAIL
      Trace events from another Worker.
    • ALARM

      public static final Triggers ALARM
      A Durable Object alarm.
  • Method Details

    • values

      public static Triggers[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Triggers valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • interfaceName

      public String interfaceName()
      Returns the interface a handler implements to handle this trigger.
      Returns:
      the interface a handler implements to handle this trigger
    • exportName

      public String exportName()
      Returns the name the generated Worker exports for this trigger.
      Returns:
      the name the generated Worker exports for this trigger
    • of

      public static List<Triggers> of(String handlerClass, Iterable<File> classpath)
      Reads the triggers a class handles.

      Loads the class without initialising it, so no user code runs. The alternative would be parsing the class file, which answers the same question with more that can go wrong.

      Parameters:
      handlerClass - the fully qualified class name
      classpath - where to find it and the interfaces it implements
      Returns:
      the triggers, in declaration order