Package org.jdbi.v3.core.statement
Class Binding
- java.lang.Object
-
- org.jdbi.v3.core.statement.Binding
-
- Direct Known Subclasses:
PreparedBinding
public class Binding extends java.lang.ObjectRepresents the arguments bound to a particular statement.
-
-
Field Summary
Fields Modifier and Type Field Description private StatementContextctxprotected java.util.Map<java.lang.String,java.lang.Object>namedprotected java.util.List<NamedArgumentFinder>namedArgumentFinderprotected java.util.Map<java.lang.Integer,java.lang.Object>positionals
-
Constructor Summary
Constructors Modifier Constructor Description protectedBinding(StatementContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddNamed(java.lang.String name, java.lang.Object argument)Bind a named parameter for the given name.voidaddNamed(java.lang.String name, java.lang.Object argument, QualifiedType<?> type)Bind a named parameter for the given name.voidaddNamed(java.lang.String name, Argument argument)Bind a named parameter for the given name.voidaddNamedArgumentFinder(NamedArgumentFinder args)Bind a named argument finder.voidaddPositional(int position, java.lang.Object argument)Bind a positional parameter at the given index (0-based).voidaddPositional(int position, java.lang.Object argument, QualifiedType<?> type)Bind a positional parameter at the given index (0-based).voidaddPositional(int position, Argument argument)Bind a positional parameter at the given index (0-based).voidclear()Remove all bindings from this Binding.java.util.Optional<Argument>findForName(java.lang.String name, StatementContext ctx2)Deprecated.don't inspect a Binding: keep your own state!java.util.Optional<Argument>findForPosition(int position)Deprecated.don't inspect a Binding: keep your own state!java.util.Collection<java.lang.String>getNames()Deprecated.this is expensive to compute, and it's bad practice to inspect a Binding: keep track of your own state!booleanisEmpty()Returns whether any bindings exist.java.lang.StringtoString()
-
-
-
Field Detail
-
positionals
protected final java.util.Map<java.lang.Integer,java.lang.Object> positionals
-
named
protected final java.util.Map<java.lang.String,java.lang.Object> named
-
namedArgumentFinder
protected final java.util.List<NamedArgumentFinder> namedArgumentFinder
-
ctx
private final StatementContext ctx
-
-
Constructor Detail
-
Binding
protected Binding(StatementContext ctx)
-
-
Method Detail
-
addPositional
public void addPositional(int position, Argument argument)Bind a positional parameter at the given index (0-based).- Parameters:
position- binding positionargument- the argument to bind
-
addNamed
public void addNamed(java.lang.String name, Argument argument)Bind a named parameter for the given name.- Parameters:
name- bound argument nameargument- the argument to bind
-
addPositional
public void addPositional(int position, java.lang.Object argument)Bind a positional parameter at the given index (0-based).- Parameters:
position- binding positionargument- the argument to bind
-
addNamed
public void addNamed(java.lang.String name, java.lang.Object argument)Bind a named parameter for the given name.- Parameters:
name- bound argument nameargument- the argument to bind
-
addPositional
public void addPositional(int position, java.lang.Object argument, QualifiedType<?> type)Bind a positional parameter at the given index (0-based).- Parameters:
position- binding positionargument- the argument to bind
-
addNamed
public void addNamed(java.lang.String name, java.lang.Object argument, QualifiedType<?> type)Bind a named parameter for the given name.- Parameters:
name- bound argument nameargument- 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 java.util.Optional<Argument> findForName(java.lang.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 ofctx2- the statement context- Returns:
- the bound Argument
-
getNames
@Deprecated public java.util.Collection<java.lang.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 java.util.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
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.
-
-