Class ObjectArgument

  • All Implemented Interfaces:
    Argument

    public class ObjectArgument
    extends java.lang.Object
    implements Argument
    An Argument which uses setObject to support vendor specific types.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Integer sqlType  
      private java.lang.Object value  
    • Constructor Summary

      Constructors 
      Constructor Description
      ObjectArgument​(java.lang.Object value, java.lang.Integer sqlType)
      Deprecated.
      use of(Object, Integer) factory method for more consistent null handling
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void apply​(int position, java.sql.PreparedStatement statement, StatementContext ctx)
      Apply the argument to the given prepared statement.
      static Argument of​(java.lang.Object value)
      Bind a vendor-supported object with the given SQL type.
      static Argument of​(java.lang.Object value, java.lang.Integer sqlType)
      Bind a vendor-supported object with the given SQL type.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • value

        private final java.lang.Object value
      • sqlType

        private final java.lang.Integer sqlType
    • Constructor Detail

      • ObjectArgument

        @Deprecated
        public ObjectArgument​(java.lang.Object value,
                              java.lang.Integer sqlType)
        Deprecated.
        use of(Object, Integer) factory method for more consistent null handling
        Bind a vendor-supported object with the given SQL type.
        Parameters:
        value - the value to call @link PreparedStatement.setObject(int, Object) with
        sqlType - the type to bind
        See Also:
        Types
    • Method Detail

      • of

        public static Argument of​(java.lang.Object value)
        Bind a vendor-supported object with the given SQL type.
        Parameters:
        value - the value to call @link PreparedStatement.setObject(int, Object) with
        Returns:
        the Argument
      • of

        public static Argument of​(java.lang.Object value,
                                  java.lang.Integer sqlType)
        Bind a vendor-supported object with the given SQL type.
        Parameters:
        value - the value to call @link PreparedStatement.setObject(int, Object, int) with
        sqlType - the type to bind
        Returns:
        the Argument
        See Also:
        Types
      • apply

        public void apply​(int position,
                          java.sql.PreparedStatement statement,
                          StatementContext ctx)
                   throws java.sql.SQLException
        Description copied from interface: Argument
        Apply the argument to the given prepared statement.
        Specified by:
        apply in interface Argument
        Parameters:
        position - the position to which the argument should be bound, using the stupid JDBC "start at 1" bit
        statement - the prepared statement the argument is to be bound to
        ctx - the statement context
        Throws:
        java.sql.SQLException - if anything goes wrong
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object