Link to home
Start Free TrialLog in
Avatar of mmoore
mmooreFlag for United States of America

asked on

need java.sql.Number documentation

Where can I get the class documentation for the
java.sql.Number class. Not the documentation
produced by javap but the real stuff.
Avatar of gwalters
gwalters

I can't find any such thing in java.sql.  Are you sure you don't want java.lang.Number?


Avatar of mmoore

ASKER

Well, I do a javap java.sql.Numeric and get

Compiled from Numeric.java public final class java.sql.Numeric extends
java.lang.Number {
    static final int SRADIX;
    public static final java.sql.Numeric ZERO;
    public static final java.sql.Numeric ONE;
    public static void setRoundingValue(int);
    public static int getRoundingValue();
    public java.sql.Numeric(java.lang.String);
    public java.sql.Numeric(java.lang.String,int);
    public java.sql.Numeric(int,int);
    public java.sql.Numeric(int);
    public java.sql.Numeric(long,int);
    public java.sql.Numeric(long);
    public java.sql.Numeric(double,int);
    public java.sql.Numeric(java.sql.Numeric);
    public java.sql.Numeric(java.sql.Numeric,int);
    public static java.sql.Numeric createFromByteArray(byte[]);
    public static java.sql.Numeric createFromIntegerArray(int[]);
    public static java.sql.Numeric createFromScaled(long, int);
    public static java.sql.Numeric createFromRadixString(java.lang.String,
int);
    public static java.sql.Numeric random(int, java.util.Random);
    public int intValue();
    public long longValue();
    public float floatValue();
    public double doubleValue();
    public java.lang.String toString();
    public java.lang.String toString(int);
    public int getScale();
    public long getScaled();
    public java.sql.Numeric add(java.sql.Numeric);
    public java.sql.Numeric subtract(java.sql.Numeric);
    public java.sql.Numeric multiply(java.sql.Numeric);
    public java.sql.Numeric divide(java.sql.Numeric);
    public java.sql.Numeric integerDivide(java.sql.Numeric)[];
    public java.sql.Numeric remainder(java.sql.Numeric);
    public java.sql.Numeric sqrt();
    public java.sql.Numeric pow(int);
    public boolean equals(java.lang.Object);
    public boolean lessThan(java.sql.Numeric);
    public boolean lessThanOrEquals(java.sql.Numeric);
    public boolean greaterThan(java.sql.Numeric);
    public boolean greaterThanOrEquals(java.sql.Numeric);
    public int hashCode();
    public java.sql.Numeric setScale(int);
    public int significantBits();
    public java.sql.Numeric shiftRight(int);
    public java.sql.Numeric shiftLeft(int);
    public java.sql.Numeric modInverse(java.sql.Numeric);
    public java.sql.Numeric modExp(java.sql.Numeric, java.sql.Numeric);
    public boolean isProbablePrime();
    public static java.sql.Numeric pi(int);
    static void div(java.sql.Numeric, java.sql.Numeric, java.sql.Numeric);
    static static {};
}

So I think it does exist.
Avatar of mmoore

ASKER

What I am really trying to figure out is how to load a string
without rounding it.
I have loaded a string with
java.sql.Numeric xyz = new java.sql.Numeric(strVar);
but if my string strVar is 2.5 it gets rounded up to 6.
It is not clear to me from the javap output what I need
to do to control the rounding. So, if you can tell me how
to do this, the points and my thanks are yours.
ASKER CERTIFIED SOLUTION
Avatar of gwalters
gwalters

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mmoore

ASKER

Ah, I had actually tried using a float first, but once I
got it into java.lang.Float, I did not know how to get
it into float. I am using JDBC which requires float.
(as opposed to java.lang.Float)
So, I did as you said and the number went straight into
the Oracle database no problem, except that the number
was still being rounded. Further investigation revealed
that I had defined the database column as number(3).
So, THAT was my problem all along. Oh well, at least I
learned a few things along the way. :-) {I'd still like to
find the java.sql.Numeric documentation.}