Record Class Tagged<T>

java.lang.Object
java.lang.Record
ai.badmonkey.agentspaces.agent.Tagged<T>
Type Parameters:
T - the entry type
Record Components:
entry - the entry to write
tags - the tags to write it with

public record Tagged<T>(T entry, Map<String,String> tags) extends Record
An entry returned from a bound method together with the tags it should be written with (SPEC ยง10.3, issue #16). The binder unwraps it before any other return handling: a same-space take result goes through complete(taken, entry, lease, tags), atomically with the completion, and anything else through write(entry, lease, tags). The sibling of Contribution: a return value the binder recognises, so no annotation attribute has to fix at bind time what usually depends on the entry.
@SpaceNotify(space = "intake")
public Tagged<Instance> estimate(RegisteredClaim claim) {
    return Tagged.of(Instance.damageFinding(claim), "claimId", claim.claimId(),
            "rdf:type", Vocabulary.DAMAGE_FINDING);
}
  • Constructor Summary

    Constructors
    Constructor
    Description
    Tagged(T entry, Map<String,String> tags)
    Creates an instance of a Tagged record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the entry record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    static <T> Tagged<T>
    of(T entry, String... keysAndValues)
    Wraps an entry with tags given as alternating keys and values.
    static <T> Tagged<T>
    of(T entry, Map<String,String> tags)
    Wraps an entry with its tags.
    Returns the value of the tags record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Tagged

      public Tagged(T entry, Map<String,String> tags)
      Creates an instance of a Tagged record class.
      Parameters:
      entry - the value for the entry record component
      tags - the value for the tags record component
  • Method Details

    • of

      public static <T> Tagged<T> of(T entry, Map<String,String> tags)
      Wraps an entry with its tags.
    • of

      public static <T> Tagged<T> of(T entry, String... keysAndValues)
      Wraps an entry with tags given as alternating keys and values.
      Throws:
      IllegalArgumentException - when the keys and values do not pair up
    • 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.
    • entry

      public T entry()
      Returns the value of the entry record component.
      Returns:
      the value of the entry record component
    • tags

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