Class Binding

java.lang.Object
org.jdbi.v3.core.statement.Binding

public class Binding extends Object
Represents the arguments bound to a particular statement.
  • Method Details

    • addPositional

      public void addPositional(int position, Argument argument)
      Bind a positional parameter at the given index (0-based).
      Parameters:
      position - binding position
      argument - the argument to bind
    • addNamed

      public void addNamed(String name, Argument argument)
      Bind a named parameter for the given name.
      Parameters:
      name - bound argument name
      argument - the argument to bind
    • addPositional

      public void addPositional(int position, Object argument)
      Bind a positional parameter at the given index (0-based).
      Parameters:
      position - binding position
      argument - the argument to bind
    • addNamed

      public void addNamed(String name, Object argument)
      Bind a named parameter for the given name.
      Parameters:
      name - bound argument name
      argument - the argument to bind
    • addPositional

      public void addPositional(int position, Object argument, QualifiedType<?> type)
      Bind a positional parameter at the given index (0-based).
      Parameters:
      position - binding position
      argument - the argument to bind
    • addNamed

      public void addNamed(String name, Object argument, QualifiedType<?> type)
      Bind a named parameter for the given name.
      Parameters:
      name - bound argument name
      argument - the argument to bind
    • addNamedArgumentFinder

      public void addNamedArgumentFinder(NamedArgumentFinder args)
      Bind a named argument finder.
      Parameters:
      args - the argument finder to bind
    • findForName

      @Deprecated public Optional<Argument> findForName(String name, StatementContext ctx2)
      Deprecated.
      don't inspect a Binding: keep your own state!
      Look up an argument by name.
      Parameters:
      name - the key to lookup the value of
      ctx2 - the statement context
      Returns:
      the bound Argument
    • getNames

      @Deprecated public Collection<String> getNames()
      Deprecated.
      this is expensive to compute, and it's bad practice to inspect a Binding: keep track of your own state!
      Returns:
      the set of known binding names
    • findForPosition

      @Deprecated public Optional<Argument> findForPosition(int position)
      Deprecated.
      don't inspect a Binding: keep your own state!
      Look up an argument by position.
      Parameters:
      position - starts at 0, not 1
      Returns:
      argument bound to that position
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • describe

      public String describe(int maxLength)
      Generate toString but with a maximum length. This is used to generate a preview even if the arguments may be very long.
      Parameters:
      maxLength - The maximum length of string to return
      Returns:
      toString truncated to maxLength
    • clear

      public void clear()
      Remove all bindings from this Binding.
    • isEmpty

      public boolean isEmpty()
      Returns whether any bindings exist.
      Returns:
      True if there are no bindings.