/** Convience method for NUMBER construction */ protected final NUMBER toNUMBER(int number) { return new NUMBER(number); }
/** Presents datum as an int */ protected int asInteger(Datum datum, final int DEFAULT) throws SQLException { if (datum == null) return DEFAULT; return ((NUMBER) datum).intValue(); } /** Presents datum as a double */
/** Presents datum as a double */ protected double asDouble(Datum datum, final double DEFAULT) throws SQLException { if (datum == null) return DEFAULT; return ((NUMBER) datum).doubleValue(); }
protected Object convertNumericAsTinyInt(Column column, Field fieldDefn, Object data) { if (data instanceof NUMBER) { try { data = ((NUMBER)data).byteValue(); } catch (SQLException e) { throw new RuntimeException("Couldn't convert value for column " + column.name(), e); } } return convertTinyInt(column, fieldDefn, data); }
@Override protected Object convertDecimal(Column column, Field fieldDefn, Object data) { if (data instanceof NUMBER) { try { data = ((NUMBER)data).bigDecimalValue(); } catch (SQLException e) { throw new RuntimeException("Couldn't convert value for column " + column.name(), e); } } // adjust scale to column's scale if the column's scale is larger than the one from // the value (e.g. 4.4444 -> 4.444400) if (data instanceof BigDecimal) { data = withScaleAdjustedIfNeeded(column, (BigDecimal) data); } return super.convertDecimal(column, fieldDefn, data); }
@Override protected Object convertFloat(Column column, Field fieldDefn, Object data) { if (data instanceof Float) { return data; } else if (data instanceof NUMBER) { return ((NUMBER)data).floatValue(); } else if (data instanceof BINARY_FLOAT) { try { return ((BINARY_FLOAT)data).floatValue(); } catch (SQLException e) { throw new RuntimeException("Couldn't convert value for column " + column.name(), e); } } return super.convertFloat(column, fieldDefn, data); }
/** * Convience method for NUMBER construction. * * <p>Double.NaN is represented as <code>NULL</code> to agree with JTS use. */ protected final NUMBER toNUMBER(double number) throws SQLException { if (Double.isNaN(number)) { return null; } return new NUMBER(number); }
/** Presents datum as an int */ protected int asInteger( Datum datum, final int DEFAULT ) throws SQLException { if( datum == null) return DEFAULT; return ((NUMBER) datum).intValue(); } /** Presents datum as a double */
/** Presents datum as a double */ protected double asDouble( Datum datum, final double DEFAULT ) throws SQLException { if( datum == null) return DEFAULT; return ((NUMBER) datum).doubleValue(); }
/** Convience method for NUMBER construction */ protected final NUMBER toNUMBER( int number ) { return new NUMBER( number ); }
/** * Converts an Oracle <code>Datum</code> into an <code>int</code> value, * with a default value used if the datum is NULL. * * @param datum the Oracle Datum * @param defaultValue the value to use for NULLs * @return an integer value * @throws SQLException if an error occurs */ public static int toInteger(Datum datum, final int defaultValue) throws SQLException { if (datum == null) return defaultValue; return ((NUMBER) datum).intValue(); }
/** Presents datum as a double */ public static double toDouble(Datum datum, final double defaultValue) { if (datum == null) return defaultValue; return ((NUMBER) datum).doubleValue(); }
NUMBER number = new NUMBER(12345); ANYDATA myAnyDataObject = ANYDATA.convertDatum(number);
@Override protected Object convertInteger(Column column, Field fieldDefn, Object data) { if (data instanceof NUMBER) { try { data = ((NUMBER)data).intValue(); } catch (SQLException e) { throw new RuntimeException("Couldn't convert value for column " + column.name(), e); } } return super.convertInteger(column, fieldDefn, data); }
/** * Convience method for NUMBER construction. * <p> * Double.NaN is represented as <code>NULL</code> to agree * with JTS use.</p> */ protected final NUMBER toNUMBER( double number ) throws SQLException{ if( Double.isNaN( number )){ return null; } return new NUMBER( number ); }
protected Object convertNumericAsInteger(Column column, Field fieldDefn, Object data) { if (data instanceof NUMBER) { try { data = ((NUMBER)data).intValue(); } catch (SQLException e) { throw new RuntimeException("Couldn't convert value for column " + column.name(), e); } } return super.convertInteger(column, fieldDefn, data); }
/** * Convenience method for NUMBER construction. * <p> * Double.NaN is represented as <code>NULL</code> to agree with JTS use. * </p> */ public static NUMBER toNUMBER(double number) throws SQLException { if (Double.isNaN(number)) { return null; } return new NUMBER(number); }
private byte[] convertScnToPosition(long scn) { try { return XStreamUtility.convertSCNToPosition(new NUMBER(scn), this.posVersion); } catch (StreamsException e) { throw new RuntimeException(e); } } }
field1 = new NUMBER(n); field2 = new CHAR(c,oracle.sql.CharacterSet.make(conn.getStructAttrCsId()));