Class OutParameters

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

public class OutParameters extends Object
Holds all output parameters from a stored procedure call using Call. Since output parameters can themselves be streaming result sets or cursors, it is important to consume your OutParameters before closing the Call or Handle they came from.
See Also:
  • Method Details Link icon

    • getResultSet Link icon

      public ResultBearing getResultSet()
      Returns a ResultBearing backed by the main result set returned by the procedure. This is not supported by all databases.
      Returns:
      A ResultBearing. This is never null but may be empty.
      Since:
      3.43.0
    • getObject Link icon

      @Nullable public <T> T getObject(String name, Class<T> type)
      Retrieves an out parameter and casts it to a specific type.
      Type Parameters:
      T - the output parameter type
      Parameters:
      name - The out parameter name
      type - The java type to obtain
      Returns:
      the output of name as type T
      Throws:
      ClassCastException - If the parameter can not be cast to type T
    • getObject Link icon

      @Nullable public <T> T getObject(int pos, Class<T> type)
      Retrieves an out parameter and casts it to a specific type.
      Type Parameters:
      T - the output parameter type
      Parameters:
      pos - The out parameter index
      type - The java type to obtain
      Returns:
      the output of name as type T
      Throws:
      ClassCastException - If the parameter can not be cast to type T
    • getObject Link icon

      @Nullable public Object getObject(String name)
      Retrieves an out parameter as an object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an Object. Can be null.
    • getObject Link icon

      @Nullable public Object getObject(int pos)
      Retrieves an out parameter as an object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an Object. Can be null.
    • getString Link icon

      @Nullable public String getString(String name)
      Retrieves an out parameter as a string.
      Parameters:
      name - The out parameter name
      Returns:
      The value as a String. Can be null.
    • getString Link icon

      @Nullable public String getString(int pos)
      Retrieves an out parameter as a string.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as a String. Can be null.
    • getBytes Link icon

      @Nullable public byte[] getBytes(String name)
      Retrieves an out parameter as a byte array.
      Parameters:
      name - The out parameter name
      Returns:
      The value as a byte array. Can be null.
    • getBytes Link icon

      @Nullable public byte[] getBytes(int pos)
      Retrieves an out parameter as a byte array.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as a byte array. Can be null.
    • getInt Link icon

      @Nullable public Integer getInt(String name)
      Retrieves an out parameter as a Integer object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an Integer object. Can be null.
    • getInt Link icon

      @Nullable public Integer getInt(int pos)
      Retrieves an out parameter as a Integer object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an Integer object. Can be null.
    • getIntValue Link icon

      public int getIntValue(String name)
      Retrieves an out parameter as a int value.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an int. Returns 0 if the value is absent.
      Since:
      3.43.0
    • getIntValue Link icon

      public int getIntValue(int pos)
      Retrieves an out parameter as a int value.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an int. Returns 0 if the value is absent.
      Since:
      3.43.0
    • getLong Link icon

      @Nullable public Long getLong(String name)
      Retrieves an out parameter as a Long object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an Long object. Can be null.
    • getLong Link icon

      @Nullable public Long getLong(int pos)
      Retrieves an out parameter as a Long object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an Long object. Can be null.
    • getLongValue Link icon

      public long getLongValue(String name)
      Retrieves an out parameter as a long value.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an long. Returns 0 if the value is absent.
      Since:
      3.43.0
    • getLongValue Link icon

      public long getLongValue(int pos)
      Retrieves an out parameter as a long value.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an long. Returns 0 if the value is absent.
      Since:
      3.43.0
    • getShort Link icon

      @Nullable public Short getShort(String name)
      Retrieves an out parameter as a Short object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an Short object. Can be null.
    • getShort Link icon

      @Nullable public Short getShort(int pos)
      Retrieves an out parameter as a Short object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an Short object. Can be null.
    • getShortValue Link icon

      public short getShortValue(String name)
      Retrieves an out parameter as a short value.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an short. Returns 0 if the value is absent.
      Since:
      3.43.0
    • getShortValue Link icon

      public short getShortValue(int pos)
      Retrieves an out parameter as a short value.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an short. Returns 0 if the value is absent.
      Since:
      3.43.0
    • getDate Link icon

      @Nullable public Date getDate(String name)
      Retrieves an out parameter as a Date object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as a Date object. Can be null.
    • getDate Link icon

      @Nullable public Date getDate(int pos)
      Retrieves an out parameter as a Date object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as a Date object. Can be null.
    • getTimestamp Link icon

      @Nullable public Timestamp getTimestamp(String name)
      Retrieves an out parameter as a Timestamp object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as a Timestamp object. Can be null.
    • getTimestamp Link icon

      @Nullable public Timestamp getTimestamp(int pos)
      Retrieves an out parameter as a Timestamp object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as a Timestamp object. Can be null.
    • getDouble Link icon

      @Nullable public Double getDouble(String name)
      Retrieves an out parameter as a Double object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an Double object. Can be null.
    • getDouble Link icon

      @Nullable public Double getDouble(int pos)
      Retrieves an out parameter as a Double object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an Double object. Can be null.
    • getDoubleValue Link icon

      public double getDoubleValue(String name)
      Retrieves an out parameter as a double value.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an double. Returns 0.0d if the value is absent.
      Since:
      3.43.0
    • getDoubleValue Link icon

      public double getDoubleValue(int pos)
      Retrieves an out parameter as a double value.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an double. Returns 0.0d if the value is absent.
      Since:
      3.43.0
    • getFloat Link icon

      @Nullable public Float getFloat(String name)
      Retrieves an out parameter as a Float object.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an Float object. Can be null.
    • getFloat Link icon

      @Nullable public Float getFloat(int pos)
      Retrieves an out parameter as a Float object.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an Float object. Can be null.
    • getFloatValue Link icon

      public float getFloatValue(String name)
      Retrieves an out parameter as a float value.
      Parameters:
      name - The out parameter name
      Returns:
      The value as an float. Returns 0.0f if the value is absent.
      Since:
      3.43.0
    • getFloatValue Link icon

      public float getFloatValue(int pos)
      Retrieves an out parameter as a float value.
      Parameters:
      pos - The out parameter index
      Returns:
      The value as an float. Returns 0.0f if the value is absent.
      Since:
      3.43.0
    • getRowSet Link icon

      @Nonnull public ResultBearing getRowSet(String name)
      Retrieves a ResultBearing for an out parameter. This usually requires that the out parameter is a cursor type.
      Parameters:
      name - The out parameter name
      Returns:
      A ResultBearing object representing the out parameter and backed by the cursor. This is not supported by all database drivers. Never null but may be empty.
    • getRowSet Link icon

      @Nonnull public ResultBearing getRowSet(int pos)
      Retrieves a ResultBearing for an out parameter. This usually requires that the out parameter is a cursor type.
      Parameters:
      pos - The out parameter index
      Returns:
      A ResultBearing object representing the out parameter and backed by the cursor. This is not supported by all database drivers. Never null but may be empty.