public class NumericFormat extends java.lang.Object implements IFormat
NumericalFormat is a utility class to format numeric value. You can specify the no of decimal point, currency symbol, thousand separator etc.
LocaleNumericFormat
Modifier and Type | Field and Description |
---|---|
int |
currencyPos
currency position, 0 - before number (default), 1 - after negative sign, 2 - after number .
|
char |
currencySymbol
Deprecated.
|
int |
decimal
decimal point, range from 1 to 6, default 2
|
char |
decimalSep
decimal point char, default '.'
|
boolean |
leadingZero
leading zero, 0 or 1
|
int |
negative
negative position, 0 - before currency sign (default), 1 - after currency sign, 2 - end of
number
|
boolean |
oneSymPerPage
Deprecated.
not used.
|
int |
rounding
no.
|
boolean |
sciExp
either 0 or 1, invalid when not currency, default 0
|
char |
thousandSep
thousand separator, if 'N' means no thousand separator.
|
BARCODE, DATETIME, IMAGEURL, LOCALEDATETIME, LOCALENUMERIC, LOGICAL, NUMERIC, STRING, TEXTURL
Constructor and Description |
---|
NumericFormat()
Create a new numeric format with default values
|
Modifier and Type | Method and Description |
---|---|
static NumericFormat |
createFormat(java.lang.String text)
For internal use only
|
java.lang.String |
format(java.lang.Object obj)
Define quadbase.reportdesigner.util.IFormat Use the doubleValue() method in java.lang.Number
to return a formatted string If the target object is not an instance of Number, use the
default toString() method
|
java.lang.String |
getCustomCurrency()
Get custom multi-character currency symbol
Deprecates the old char type currency symbol variable "currencySymbol"
|
int |
getFormatType()
Define quadbase.reportdesigner.util.IFormat Return the type of
quadbase.reportdesigner.util.IFormat
|
java.lang.String |
getTextFormat()
For internal use only
|
java.lang.String |
output(double d)
Output the formatted number
|
void |
setCustomCurrency(java.lang.String customCurrency)
Set custom multi-character currency symbol
Deprecates the old char type currency symbol variable "currencySymbol"
|
void |
setDefault()
Set all variables to default value
|
void |
setFormat(char currSymInit,
boolean oneSymPerPageInit,
int currencyPosInit,
int decimalInit,
int roundingInit,
int negativeInit,
char decimalSepInit,
char thousandSepInit,
boolean leadingZeroInit)
Set Numeric format
|
void |
setFormat(char currSymInit,
boolean oneSymPerPageInit,
int currencyPosInit,
int decimalInit,
int roundingInit,
int negativeInit,
char decimalSepInit,
char thousandSepInit,
boolean leadingZeroInit,
java.lang.String customCurrency)
Set Numeric format
|
void |
setScientifExp(int precision)
Set scientific expression
|
java.lang.String |
toString()
For internal use only
|
void |
writeCustomCurrency(quadbase.common.util.internal.VersioningDataOutput out) |
public boolean sciExp
@Deprecated public char currencySymbol
@Deprecated public boolean oneSymPerPage
public int currencyPos
public int decimal
public int rounding
public int negative
public char decimalSep
public char thousandSep
public boolean leadingZero
public NumericFormat()
public java.lang.String getCustomCurrency()
public void setCustomCurrency(java.lang.String customCurrency)
public int getFormatType()
getFormatType
in interface IFormat
public java.lang.String format(java.lang.Object obj)
public void setDefault()
public void setScientifExp(int precision)
precision
- no of decimal pointpublic void setFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit)
currSymInit
- currency symboloneSymPerPageInit
- not used, always set to falsecurrencyPosInit
- currency position 0-2decimalInit
- no. of decimal pointroundingInit
- no. of significant digitnegativeInit
- negative symbol position 0-2decimalSepInit
- decimal point symbolthoudsandSepInit
- thousands separator symbol, 'N' means no thousands separatorleadingZeroInit
- leading zeropublic void setFormat(char currSymInit, boolean oneSymPerPageInit, int currencyPosInit, int decimalInit, int roundingInit, int negativeInit, char decimalSepInit, char thousandSepInit, boolean leadingZeroInit, java.lang.String customCurrency)
currSymInit
- currency symboloneSymPerPageInit
- not used, always set to falsecurrencyPosInit
- currency position 0-2decimalInit
- no. of decimal pointroundingInit
- no. of significant digitnegativeInit
- negative symbol position 0-2decimalSepInit
- decimal point symbolthoudsandSepInit
- thousands separator symbol, 'N' means no thousands separatorleadingZeroInit
- leading zerocustomCurrency
- custom currency signpublic java.lang.String output(double d)
d
- number to be formattedpublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getTextFormat()
getTextFormat
in interface IFormat
public static NumericFormat createFormat(java.lang.String text) throws java.lang.Exception
java.lang.Exception
public void writeCustomCurrency(quadbase.common.util.internal.VersioningDataOutput out) throws java.io.IOException
java.io.IOException