Package org.soulwing.jdbc
Class Parameter
- java.lang.Object
-
- org.soulwing.jdbc.Parameter
-
public class Parameter extends Object
An SQL parameter injector.- Author:
- Carl Harris
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getType()
Gets thetype
property.Object
getValue()
Gets thevalue
property.static Parameter
in(int type, Object value)
Creates a new input parameter with the given value.static Parameter
in(Object value)
Creates a new input parameter with the given value.void
inject(int parameterIndex, PreparedStatement statement)
Injects this parameter into the given prepared statement.static Parameter
inout(int type, Object value)
Creates a new input/output parameter with the given type.static Parameter
out(int type)
Creates a new output parameter with the given type.String
toString()
String
toString(int index)
Produces a string representation of this parameter prefixed with a given index indicating its position in a parameter list.static Parameter
with(int type, Object value)
Creates a new input parameter with the given value.static Parameter
with(Object value)
Creates a new input parameter with the given value.
-
-
-
Method Detail
-
with
public static Parameter with(Object value)
Creates a new input parameter with the given value.Synonym for
in(Object)
.- Parameters:
value
- value of the parameter- Returns:
- parameter object
-
with
public static Parameter with(int type, Object value)
Creates a new input parameter with the given value.Synonym for
in(int, Object)
.- Parameters:
type
- SQL type of the parametervalue
- value of the parameter- Returns:
- parameter object
-
in
public static Parameter in(Object value)
Creates a new input parameter with the given value.- Parameters:
value
- value of the parameter- Returns:
- parameter object
-
in
public static Parameter in(int type, Object value)
Creates a new input parameter with the given value.Synonym for
in(Object)
.- Parameters:
type
- SQL type of the parametervalue
- value of the parameter- Returns:
- parameter object
-
out
public static Parameter out(int type)
Creates a new output parameter with the given type.- Parameters:
type
- SQL type of the parameter- Returns:
- parameter object
-
inout
public static Parameter inout(int type, Object value)
Creates a new input/output parameter with the given type.- Parameters:
type
- SQL type of the parametervalue
- value of the parameter- Returns:
- parameter object
-
inject
public void inject(int parameterIndex, PreparedStatement statement) throws SQLException
Injects this parameter into the given prepared statement.- Parameters:
parameterIndex
- index of the statement placeholder (starts at 1)statement
- target statement- Throws:
SQLException
-
getType
public int getType()
Gets thetype
property.- Returns:
- property value
-
getValue
public Object getValue()
Gets thevalue
property.- Returns:
- property value
-
toString
public String toString(int index)
Produces a string representation of this parameter prefixed with a given index indicating its position in a parameter list.- Parameters:
index
- the index value to include in the representation- Returns:
- parameter description
-
-