Class CriteriaParametersNamed

java.lang.Object
io.github.mmm.property.criteria.CriteriaParametersNamed
All Implemented Interfaces:
CriteriaParameters

public class CriteriaParametersNamed extends Object implements CriteriaParameters
CriteriaParameters using named parameters. It puts ":«name»" into the output and collects the parameters in a Map that can get accessed via getParameters() after the database statement has been formatted and can be bound as parameters to the statement.
Since:
1.0.0
  • Constructor Details

    • CriteriaParametersNamed

      public CriteriaParametersNamed(boolean merge)
      The constructor.
      Parameters:
      merge - the merge flag.
  • Method Details

    • isMerge

      public boolean isMerge()
      Returns:
      true if two Literals with same parameter name should be joined if their values are equal to each other, false otherwise. So if your SQL has p.Property() = 42 AND q.Property() = 42 a merge would create just one parameter ":property" with the value "42" and without merge it would add two parameters ":property" and ":property2" both with the value "42".
    • onLiteral

      public void onLiteral(Literal<?> literal, io.github.mmm.base.io.AppendableWriter out, CriteriaExpression<?> parent)
      Specified by:
      onLiteral in interface CriteriaParameters
      Parameters:
      literal - the Literal to write in database syntax (e.g. SQL) and to collect as parameter.
      out - the AppendableWriter where to write the Literal in database syntax to.
      parent - the parent CriteriaExpression containing the Literal.
    • getParameters

      public Map<String,Object> getParameters()
      Returns:
      the Map of collected named parameter values to bind to the database statement.