Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Generic Domains
11g Release 2 (11.1.2.2.0)

E17484-03


oracle.jbo.domain
Class Number

java.lang.Object
  extended by oracle.jbo.domain.Number

All Implemented Interfaces:
java.io.Serializable, oracle.jbo.domain.DomainInterface, oracle.jbo.domain.KeyAttributeInterface

public class Number
extends java.lang.Object
implements oracle.jbo.domain.DomainInterface, java.io.Serializable, oracle.jbo.domain.KeyAttributeInterface

This class provides a lightweight wrapper for java.lang.Number, the native Java type for number objects. This wrapper allows an instance of the java.lang.Number to be used as a domain object. The intent of many of the methods in this class is to wrap the corresponding method in the java.lang.Number class such that it returns an instance of an oracle.jbo.domain.Number object.

Number objects consist of data (a byte array) and a Domain type code. Domain numbers extend SQL characters by being convertable to JDBC values.

Since:
JDevloper 3.0
See Also:
Serialized Form

Constructor Summary
Number()
          Creates a Number Domain object representing zero.
Number(java.math.BigDecimal value)
          Creates a Number Domain object from a BigDecimal.
Number(java.math.BigInteger value)
          Creates a Number Domain object from a BigInteger.
Number(boolean value)
          Creates a Number Domain object from a Boolean.
Number(double value)
          Creates a Number Domain object from an double.
Number(java.lang.Double value)
          Creates a Number Domain object from an Double object.
Number(float value)
          Creates a Number Domain object from an float.
Number(int value)
          Creates a Number Domain object from an int.
Number(long value)
          Creates a Number Domain object from an long.
Number(java.lang.Long value)
          Creates a Number Domain object from an Long object.
Number(Number value)
          Creates a Number identical to an existing Number.
Number(java.lang.Object value)
          Creates a Number Domain object from a BigInteger.
Number(short value)
          Creates a Number Domain object from an short.
Number(java.lang.String value)
          Creates a Number Domain object from a Java String.
Number(java.lang.String value, int precision)
          Creates a Number Domain object from a Java String.

 

Method Summary
 java.math.BigDecimal bigDecimalValue()
          Calls toBigDecimal to convert internal Oracle Number into a Java BigDecimal.
 java.math.BigInteger bigIntegerValue()
           
 boolean booleanValue()
          Calls toBoolean to convert internal Oracle Number to a Java boolean.
 byte byteValue()
          Calls toByte to convert internal Oracle Number to a Java byte.
 int compareTo(double n)
          Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n.
 int compareTo(Number n)
          Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n.
 double doubleValue()
          Calls toDouble to convert internal Oracle Number to a Java double.
 boolean equals(java.lang.Object other)
          Tests this for equality with another object.
 float floatValue()
          Calls toFloat to convert internal Oracle Number to a Java float.
 java.math.BigDecimal getBigDecimalValue()
          Return a this domain's value as BigDecimal This method may be used to access the value for this domain in EL-expressions.
 byte[] getBytes()
           
 java.lang.Object getData()
          Converts this to an Object.
 java.lang.Number getDataAsJavaNumber()
          Converts this to an Object.
 int getPrecision()
           
 double getValue()
          Return a this domain's value as double This method may be used to access the value for this domain in EL-expressions.
 int hashCode()
          Computes the hash code.
 int intValue()
          Calls toInt to convert internal Oracle Number to a Java int.
 long longValue()
          Calls toLong to convert internal Oracle Number to a Java long.
 Number multiply(Number n)
          Multiplies this by another number.
 void setBytes(byte[] bArr)
           
 void setContext(oracle.jbo.domain.DomainOwnerInterface owner, oracle.jbo.Transaction trans, java.lang.Object ctx)
           
 short shortValue()
          Calls toShort to convert internal Oracle Number to a Java short.
 java.lang.String stringValue()
          Calls toString to convert internal Oracle Number to a Java String.
 java.lang.String toString()
          Converts this to a fixed-point number presented as a string.
static java.lang.String trimStr(java.lang.String s)
           
protected  void validate()
          Implements domain validation logic and throws a JboException on error.

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Constructor Detail

Number

public Number()
Creates a Number Domain object representing zero. Use one of the NullValue() constructors to create a null Number object.

Number

public Number(int value)
Creates a Number Domain object from an int.
Parameters:
value - a 32-bit signed integer.

Number

public Number(java.lang.Long value)
Creates a Number Domain object from an Long object.
Parameters:
value - a 64-bit signed integer.

Number

public Number(long value)
Creates a Number Domain object from an long.
Parameters:
value - a 64-bit signed integer.

Number

public Number(short value)
Creates a Number Domain object from an short.
Parameters:
value - a 16-bit signed integer.

Number

public Number(float value)
Creates a Number Domain object from an float.
Parameters:
value - a 32-bit floating-point value.

Number

public Number(java.lang.Double value)
Creates a Number Domain object from an Double object.
Parameters:
value - a 64-bit floating-point value.

Number

public Number(double value)
Creates a Number Domain object from an double.
Parameters:
value - a 64-bit floating-point value.
Throws:
SQLException - on over/underflow of the exponent or on overflow of the mantissa.

Number

public Number(java.math.BigDecimal value)
Creates a Number Domain object from a BigDecimal.

Number

public Number(java.math.BigInteger value)
Creates a Number Domain object from a BigInteger.
Parameters:
value - an arbitrarily integer.

Number

public Number(java.lang.Object value)
Creates a Number Domain object from a BigInteger.
Parameters:
value - an arbitrarily integer.

Number

public Number(java.lang.String value,
              int precision)
Creates a Number Domain object from a Java String.
Parameters:
value - a textual representation of a fixed-point number.
precision - ...
Throws:
SQLException - on overflow.

Number

public Number(java.lang.String value)
Creates a Number Domain object from a Java String.
Parameters:
value - a textual representation of a BigDecimal.
Throws:
java.sql.SQLException - on over/underflow of the exponent or on overflow of the mantissa, or if the string does not represent a valid number.

Number

public Number(boolean value)
Creates a Number Domain object from a Boolean.
Parameters:
value - true or false. The new instance of Number is 0 if value is false, or 1 otherwise.

Number

public Number(Number value)
Creates a Number identical to an existing Number.
Parameters:
value - a Number Domain object.
Throws:
SQLException - never.

Method Detail

getPrecision

public int getPrecision()

getDataAsJavaNumber

public java.lang.Number getDataAsJavaNumber()
Converts this to an Object.

getBigDecimalValue

public java.math.BigDecimal getBigDecimalValue()
Return a this domain's value as BigDecimal This method may be used to access the value for this domain in EL-expressions.

getValue

public double getValue()
Return a this domain's value as double This method may be used to access the value for this domain in EL-expressions.

getData

public java.lang.Object getData()
Converts this to an Object.
Specified by:
getData in interface oracle.jbo.domain.DomainInterface

setContext

public void setContext(oracle.jbo.domain.DomainOwnerInterface owner,
                       oracle.jbo.Transaction trans,
                       java.lang.Object ctx)
Specified by:
setContext in interface oracle.jbo.domain.DomainInterface

trimStr

public static java.lang.String trimStr(java.lang.String s)

toString

public java.lang.String toString()
Converts this to a fixed-point number presented as a string.
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Tests this for equality with another object.
Overrides:
equals in class java.lang.Object
Parameters:
other - an arbitrary Object.
Returns:
true if conversion was successful and the converted argument is identical to this.

hashCode

public int hashCode()
Computes the hash code.
Overrides:
hashCode in class java.lang.Object
Returns:
the hash code of this.

validate

protected void validate()
Implements domain validation logic and throws a JboException on error.

compareTo

public int compareTo(double n)
Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n.
Parameters:
n - input Oracle Number
Returns:
integer result of comparison

compareTo

public int compareTo(Number n)
Returns -1 if NUMBER is less than n, 0 if NUMBER and n are equal (==), 1 if NUMBER is greater than n.
Parameters:
n - input Oracle Number
Returns:
integer result of comparison

multiply

public Number multiply(Number n)
Multiplies this by another number.
Parameters:
n - a number.
Returns:
a new Number object.

doubleValue

public double doubleValue()
Calls toDouble to convert internal Oracle Number to a Java double.
Returns:
a Java double value

floatValue

public float floatValue()
Calls toFloat to convert internal Oracle Number to a Java float.
Returns:
a Java float value

longValue

public long longValue()
Calls toLong to convert internal Oracle Number to a Java long.
Returns:
a Java long value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

intValue

public int intValue()
Calls toInt to convert internal Oracle Number to a Java int.
Returns:
a Java int value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

shortValue

public short shortValue()
Calls toShort to convert internal Oracle Number to a Java short.
Returns:
a Java short value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

byteValue

public byte byteValue()
Calls toByte to convert internal Oracle Number to a Java byte.
Returns:
a Java byte value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

bigIntegerValue

public java.math.BigInteger bigIntegerValue()
Returns:
a Java BigInteger value
Throws:
java.sql.SQLException - if the Oracle Number exponent is out of range.

bigDecimalValue

public java.math.BigDecimal bigDecimalValue()
Calls toBigDecimal to convert internal Oracle Number into a Java BigDecimal.
Returns:
a Java BigDecimal value
Throws:
java.sql.SQLException - on over/underflow of the Oracle Number exponent and on overflow of the mantissa.

stringValue

public java.lang.String stringValue()
Calls toString to convert internal Oracle Number to a Java String.
Returns:
a Java String value

booleanValue

public boolean booleanValue()
Calls toBoolean to convert internal Oracle Number to a Java boolean.
Returns:
a Java boolean value

getBytes

public byte[] getBytes()
Specified by:
getBytes in interface oracle.jbo.domain.KeyAttributeInterface

setBytes

public void setBytes(byte[] bArr)
Specified by:
setBytes in interface oracle.jbo.domain.KeyAttributeInterface

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Generic Domains
11g Release 2 (11.1.2.2.0)

E17484-03


Copyright © 1997, 2012, Oracle. All rights reserved.