org.apache.calcite.avatica.util

## Class AbstractCursor.NumberAccessor

- java.lang.Object
- - org.apache.calcite.avatica.util.AbstractCursor.AccessorImpl
  - - org.apache.calcite.avatica.util.AbstractCursor.BigNumberAccessor
    - - org.apache.calcite.avatica.util.AbstractCursor.NumberAccessor

All Implemented Interfaces:
  Cursor.Accessor

Direct Known Subclasses:
  AbstractCursor.DateFromNumberAccessor, AbstractCursor.TimeFromNumberAccessor, AbstractCursor.TimestampFromNumberAccessor

Enclosing class:
  AbstractCursor

    static class AbstractCursor.NumberAccessor
    extends AbstractCursor.BigNumberAccessor

Accessor that assumes that the underlying value is a `Number`; corresponds to `Types.NUMERIC`.

This is useful when numbers have been translated over JSON. JSON converts a 0L (0 long) value to the string "0" and back to 0 (0 int). So you cannot be sure that the source and target type are the same.

### Field Summary

Fields
`private int` `scale`

### Fields inherited from class org.apache.calcite.avatica.util.AbstractCursor.AccessorImpl

`getter`

### Constructor Summary

Constructors
Constructor and Description
`NumberAccessor(AbstractCursor.Getter getter, int scale)`

### Method Summary

All Methods Instance Methods Concrete Methods
`BigDecimal` `getBigDecimal()`
`BigDecimal` `getBigDecimal(int scale)`
`protected Number` `getNumber()`

### Methods inherited from class org.apache.calcite.avatica.util.AbstractCursor.BigNumberAccessor

`getBoolean, getByte, getDouble, getFloat, getInt, getLong, getShort`

### Methods inherited from class org.apache.calcite.avatica.util.AbstractCursor.AccessorImpl

`getArray, getAsciiStream, getBinaryStream, getBlob, getBytes, getCharacterStream, getClob, getDate, getNCharacterStream, getNClob, getNString, getObject, getObject, getObject, getRef, getSQLXML, getString, getStruct, getTime, getTimestamp, getUnicodeStream, getURL, wasNull`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### scale

    private final int scale

### Constructor Detail

#### NumberAccessor

    public NumberAccessor(AbstractCursor.Getter getter,
                          int scale)

### Method Detail

#### getNumber

    protected Number getNumber()
                        throws SQLException

Specified by:
  `getNumber` in class `AbstractCursor.BigNumberAccessor`
Throws:
  `SQLException`

#### getBigDecimal

    public BigDecimal getBigDecimal(int scale)
                             throws SQLException

Specified by:
  `getBigDecimal` in interface `Cursor.Accessor`
Overrides:
  `getBigDecimal` in class `AbstractCursor.AccessorImpl`
Throws:
  `SQLException`

#### getBigDecimal

    public BigDecimal getBigDecimal()
                             throws SQLException

Specified by:
  `getBigDecimal` in interface `Cursor.Accessor`
Overrides:
  `getBigDecimal` in class `AbstractCursor.AccessorImpl`
Throws:
  `SQLException`