Record Class DurableObjects

java.lang.Object
java.lang.Record
dev.gmitch215.bytebox.gradle.DurableObjects
Record Components:
className - the fully qualified Java class name
sockets - whether it takes WebSockets
alarms - whether it takes alarms
All Implemented Interfaces:
Serializable

public record DurableObjects(String className, boolean sockets, boolean alarms) extends Record implements Serializable
A Durable Object class written in Java, and which of its handlers exist.

Read from the class the same way a Worker's triggers are: the interfaces it implements are already the answer, so the generated JavaScript class exposes a handler only where there is one to call.

Since:
1.0.0
See Also:
  • Constructor Details

    • DurableObjects

      public DurableObjects(String className, boolean sockets, boolean alarms)
      Creates an instance of a DurableObjects record class.
      Parameters:
      className - the value for the className record component
      sockets - the value for the sockets record component
      alarms - the value for the alarms record component
  • Method Details

    • simpleName

      public String simpleName()
      Returns the class's simple name, which is what the binding and the JavaScript class are called.
      Returns:
      the class's simple name, which is what the binding and the JavaScript class are called
    • bindingName

      public String bindingName()
      Returns the binding name, which is DO_ and the class name upper-snaked.

      Derived by the same code the bindings block uses. The plugin declares a binding for any Durable Object that has none, deciding by this name, so a second derivation that disagreed with that one would declare the same binding twice.

      Returns:
      the binding name, which is DO_ and the class name upper-snaked
    • exportPrefix

      public String exportPrefix()
      The prefix every export for this object shares.
      Returns:
      the prefix
    • of

      public static List<DurableObjects> of(List<String> classNames, Iterable<File> classpath)
      Reads each named class.

      Loaded without initialising, so no user code runs.

      Parameters:
      classNames - the fully qualified class names
      classpath - where to find them and the interfaces they implement
      Returns:
      one entry per class, in the order named
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • className

      public String className()
      Returns the value of the className record component.
      Returns:
      the value of the className record component
    • sockets

      public boolean sockets()
      Returns the value of the sockets record component.
      Returns:
      the value of the sockets record component
    • alarms

      public boolean alarms()
      Returns the value of the alarms record component.
      Returns:
      the value of the alarms record component