Class LlmQueryParameter

java.lang.Object
io.jmix.reports.llm.LlmQueryParameter

public class LlmQueryParameter extends Object
A named parameter of an LlmDataQuery: the name used in the JPQL text and the Java type of the value it stands for. A parameter declares itself; it does not carry a value. The value a run binds comes from the run — the report parameters, the rows of the parent bands, the cross-tab axes — which is what lets one stored query serve every run of the report.

The type is what a model is told the value will be, and what the stored query keeps saying about it; a run binds the value it holds as it is, without consulting the declared type. The same class describes a parameter offered to query generation and one declared by a stored query.

  • Field Details

    • name

      protected String name
    • javaType

      protected String javaType
    • multiValued

      protected transient boolean multiValued
      Transient on purpose: it describes what the run offers, not what the stored query declares, and must not become part of the stored document.
    • optional

      protected transient boolean optional
      Transient for the same reason as multiValued: whether a run may leave this parameter empty is a fact about the report, not about the query text that references it.
  • Constructor Details

    • LlmQueryParameter

      public LlmQueryParameter(String name, String javaType)
    • LlmQueryParameter

      public LlmQueryParameter(String name, String javaType, boolean multiValued)
    • LlmQueryParameter

      public LlmQueryParameter(String name, String javaType, boolean multiValued, boolean optional)
  • Method Details

    • getName

      public String getName()
      Returns:
      parameter name as used in the JPQL text, without the leading colon
    • getJavaType

      public String getJavaType()
      Returns:
      fully qualified Java type name the value is bound as, for example java.time.LocalDate
    • isMultiValued

      public boolean isMultiValued()
      Tells a parameter that carries several values of getJavaType() from an ordinary single-valued one, so that a query can match it with IN. This may be a collection-valued report parameter or the values of one cross-tab axis. Stated by whoever offers the parameter, since a parameter carries no value to infer it from.
      Returns:
      true if the value is a collection of getJavaType()
    • isOptional

      public boolean isOptional()
      Tells a parameter a run may leave empty from one it always supplies — an optional report parameter, as opposed to a required one. A query referencing an optional parameter has to survive an empty value, which in JPQL means guarding the condition with (:name is null or …); generation is told so, and a run binds null for such a parameter instead of failing.
      Returns:
      true if a run may bind null for this parameter
    • toString

      public String toString()
      Overrides:
      toString in class Object