Class Parameter


  • public class Parameter
    extends Object
    An SQL parameter injector.
    Author:
    Carl Harris
    • 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 parameter
        value - 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 parameter
        value - 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 parameter
        value - 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 the type property.
        Returns:
        property value
      • getValue

        public Object getValue()
        Gets the value 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