|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.Format
com.ftlabs.fisa.util.PriceFractionFormat
public class PriceFractionFormat
A class to format price values so that the fractional part is rounded to the nearest 32nds, 64ths, 128ths, 256ths, or 512ths. Example : Using PrecisionUnit._64 : 100.984 = 100-31+ = 100.984375
| Nested Class Summary | |
|---|---|
static class |
PriceFractionFormat.PrecisionUnit
|
| Nested classes/interfaces inherited from class java.text.Format |
|---|
java.text.Format.Field |
| Constructor Summary | |
|---|---|
PriceFractionFormat()
Create a new instance of PriceFractionFormat using PrecisionUnit._64 and "-" as the fractionDelimiter. |
|
PriceFractionFormat(PriceFractionFormat.PrecisionUnit precisionUnit)
Create a new instance of PriceFractionFormat using the provided PrecisionUnit, and "-" as the fractionDelimiter. |
|
| Method Summary | |
|---|---|
java.lang.String |
format(double value)
A specialization of format that accepts a primitive double. |
java.lang.StringBuffer |
format(java.lang.Object number,
java.lang.StringBuffer stringBuffer,
java.text.FieldPosition fieldPosition)
Formats a number to be represented to precisionUnit values and appends the resulting text to the given string buffer. |
double |
parse(java.lang.String text)
Parses a string representing a number where the fractional value is rounded to precisionUnit value. |
java.lang.Object |
parseObject(java.lang.String text,
java.text.ParsePosition parsePosition)
Parses a string representing a number where the fractional value is rounded to the nearest precisionUnit value. |
| Methods inherited from class java.text.Format |
|---|
clone, format, formatToCharacterIterator, parseObject |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PriceFractionFormat()
public PriceFractionFormat(PriceFractionFormat.PrecisionUnit precisionUnit)
precisionUnit - The PrecisionUnit used to determine the level
of precision for this PriceFractionFormat object.| Method Detail |
|---|
public java.lang.String format(double value)
public java.lang.StringBuffer format(java.lang.Object number,
java.lang.StringBuffer stringBuffer,
java.text.FieldPosition fieldPosition)
Number.
format in class java.text.Formatnumber - The number to formatstringBuffer - the StringBuffer to which the formatted text is to
be appendedfieldPosition - On input: an alignment field, if desired. On output:
the offsets of the alignment field.
public double parse(java.lang.String text)
throws java.text.ParseException
text - The text to be parsed as a decimal.
java.text.ParseException
public java.lang.Object parseObject(java.lang.String text,
java.text.ParsePosition parsePosition)
parseObject in class java.text.Formattext - The text to be parsed as a decimal.parsePosition - A ParsePosition object, used to determine the
starting position within the text string, and to indicate the next
position after parsing.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||