Record Class TemplateReference

java.lang.Object
java.lang.Record
org.apache.juneau.commons.svl.TemplateReference
Record Components:
kind - What was referenced.
name - The var prefix (P for the ${name} shortcut), the function name (operators are $op.*), the identifier, or for TemplateReference.Kind.SYNTAX the error message.
bound - Whether the name resolves in the resolver the template was compiled against: a registered var, or a registered function permitted by the allowlist. Always true for identifiers.
listName - For an identifier read as a row field (inside the body of a select or projection whose target is a top-level identifier), that identifier's name; null for a top-level identifier. Identifiers in a body whose target is anything else are not reported.
start - Start offset, inclusive.
end - End offset, exclusive.

public record TemplateReference(TemplateReference.Kind kind, String name, boolean bound, String listName, int start, int end) extends Record
One reference found in a compiled VarTemplate: a ${...} var, a function or operator call, an identifier, or a syntax problem.

Offsets are into VarTemplate.getSource(): start inclusive, end exclusive. For a var the span is the whole ${...} marker; a ${name} or ${name:default} var reference also yields an TemplateReference.Kind.IDENT entry for its key (the text before the first top-level :); for a function and an identifier it is the name token; for a syntax problem it is the offending marker.

References are reported for markers that are evaluated at render time. A stable var folded at compile time (and an expression folded with it) has no entry. A ${...} inside a nested var body is not analyzed.

  • Constructor Details

    • TemplateReference

      public TemplateReference(TemplateReference.Kind kind, String name, boolean bound, String listName, int start, int end)
      Creates an instance of a TemplateReference record class.
      Parameters:
      kind - the value for the kind record component
      name - the value for the name record component
      bound - the value for the bound record component
      listName - the value for the listName record component
      start - the value for the start record component
      end - the value for the end record component
  • Method Details

    • 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.
    • kind

      Returns the value of the kind record component.
      Returns:
      the value of the kind record component
    • name

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

      public boolean bound()
      Returns the value of the bound record component.
      Returns:
      the value of the bound record component
    • listName

      public String listName()
      Returns the value of the listName record component.
      Returns:
      the value of the listName record component
    • start

      public int start()
      Returns the value of the start record component.
      Returns:
      the value of the start record component
    • end

      public int end()
      Returns the value of the end record component.
      Returns:
      the value of the end record component