public final class BtcFixedFormat extends BtcFormat
This class, a concrete extension of BtcFormat
, is distinguished in that each
instance formats and by-default parses all Bitcoin monetary values in units of a single
denomination that is specified at the time that instance is constructed.
By default, neither currency codes nor symbols are included in formatted values as
output, nor recognized in parsed values as input. The can be overridden by applying a
custom pattern using either the BtcFormat.Builder.localizedPattern
or
BtcFormat.Builder.localizedPattern
methods, as described in the documentation for
the BtcFormat.Builder
class.
A more detailed explanation, including examples, is in the documentation for the
BtcFormat
class, and further information beyond that is in the documentation for the
Format
class, from which this class descends.
Format
,
NumberFormat
,
DecimalFormat
,
Coin
,
Serialized FormBtcFormat.Builder
Modifier and Type | Field and Description |
---|---|
static int[] |
REPEATING_DOUBLETS
A constant specifying the use of as many optional groups of two
decimal places in the fraction part of a formatted number as are useful for expressing
precision.
|
static int[] |
REPEATING_PLACES
A constant specifying the use of as many optional decimal places in the fraction part
of a formatted number as are useful for expressing precision.
|
static int[] |
REPEATING_TRIPLETS
A constant specifying the use of as many optional groups of three
decimal places in the fraction part of a formatted number as are useful for expressing
precision.
|
COIN_SCALE, COIN_SYMBOL_ALT, decimalGroups, MICROCOIN_SCALE, MILLICOIN_SCALE, minimumFractionDigits, numberFormat
Modifier | Constructor and Description |
---|---|
protected |
BtcFixedFormat(java.util.Locale locale,
int scale,
int minDecimals,
java.util.List<java.lang.Integer> groups)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
code()
Return the currency code that identifies the units in which values formatted and
(by-default) parsed by this instance are denominated.
|
boolean |
equals(java.lang.Object o)
Return true if the given object is equivalent to this one.
|
int[] |
fractionPlaceGroups()
Return the fractional decimal-placing used when formatting.
|
int |
hashCode()
Return a hash code value for this instance.
|
int |
scale()
Return the decimal-place shift for this object's fixed unit-denomination.
|
protected int |
scale(java.math.BigInteger satoshis,
int fractionPlaces)
Return the decimal-place shift for this object's unit-denomination.
|
java.lang.String |
symbol()
Return the currency symbol that identifies the units in which values formatted by this
instance are denominated.
|
java.lang.String |
toString()
Returns a brief description of this formatter.
|
builder, coinCode, coinSymbol, format, format, format, formatToCharacterIterator, getAvailableLocales, getCodeInstance, getCodeInstance, getCodeInstance, getCodeInstance, getCoinInstance, getCoinInstance, getCoinInstance, getCoinInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getMicroInstance, getMicroInstance, getMicroInstance, getMicroInstance, getMilliInstance, getMilliInstance, getMilliInstance, getMilliInstance, getSymbolInstance, getSymbolInstance, getSymbolInstance, getSymbolInstance, negify, parse, parse, parseObject, pattern, prefixCode, prefixSymbol, prefixUnitsIndicator, symbols
public static final int[] REPEATING_PLACES
BtcFormat.format(Object, int, int...)
.public static final int[] REPEATING_DOUBLETS
BtcFormat.format(Object, int, int...)
.public static final int[] REPEATING_TRIPLETS
BtcFormat.format(Object, int, int...)
.protected BtcFixedFormat(java.util.Locale locale, int scale, int minDecimals, java.util.List<java.lang.Integer> groups)
protected int scale(java.math.BigInteger satoshis, int fractionPlaces)
3
. As
a side-effect, prefixes the currency signs of the underlying NumberFormat object. This
method is invoked by the superclass when formatting. The arguments are ignored because
the denomination is fixed regardless of the value being formatted.scale
in class BtcFormat
satoshis
- The number of satoshis having the value for which the shift is calculatedfractionPlaces
- The number of decimal places available for displaying the
fractional part of the denominated valuepublic int scale()
3
.public java.lang.String code()
"mBTC"
,
assuming the default base currency-code is not overridden using a
BtcFormat.Builder
.public java.lang.String symbol()
"₥฿"
, depending on the
locale.public int[] fractionPlaceGroups()
int
array. The value of the first element is the minimum number of
decimal places to be used in all cases, limited to a precision of satoshis. The value
of each successive element is the size of an optional place-group that will be applied,
possibly partially, if useful for expressing precision. The actual size of each group
is limited to, and may be reduced to the limit of, a precision of no smaller than
satoshis.public boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
toString
in class java.lang.Object