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.
See Also:
  • Method Details

    • getResultSet

      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

      @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

      @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

      @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

      @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

      @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

      @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

      @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

      @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

      @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

      @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

      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

      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

      @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

      @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

      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

      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

      @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

      @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

      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

      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

      @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

      @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

      @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

      @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

      @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

      @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

      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

      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

      @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

      @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

      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

      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

      @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

      @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.