Record Class Binding

java.lang.Object
java.lang.Record
dev.gmitch215.bytebox.gradle.Binding
Record Components:
type - what kind of binding this is
name - the binding name, which is what env is keyed by
identifiers - the Wrangler keys for this type, in the order Wrangler expects them
All Implemented Interfaces:
Serializable

public record Binding(BindingType type, String name, Map<String,String> identifiers) extends Record implements Serializable
One declared binding, with the name it resolved to.

Identifiers are optional throughout. Wrangler provisions a resource it cannot find, so a project that has not created its KV namespace yet still builds and deploys; an identifier is for pointing a binding at a resource whose remote name differs from the binding's.

Since:
1.0.0
See Also:
  • Constructor Details

    • Binding

      public Binding(BindingType type, String name, Map<String,String> identifiers)
      Creates an instance of a Binding record class.
      Parameters:
      type - the value for the type record component
      name - the value for the name record component
      identifiers - the value for the identifiers record component
    • Binding

      public Binding(BindingType type, String name)
      Parameters:
      type - what kind of binding this is
      name - the binding name
  • Method Details

    • toConfig

      public Map<String,String> toConfig()
      This binding as the object Wrangler expects under BindingType.configKey().

      The key holding the binding name differs by type — binding for most, name for a Durable Object or a Workflow, queue for a producer — which is why this is not one shape with the name substituted.

      Returns:
      the entry, with the name key first so the generated configuration reads naturally
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • type

      public BindingType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • identifiers

      public Map<String,String> identifiers()
      Returns the value of the identifiers record component.
      Returns:
      the value of the identifiers record component