public final class MFUtil
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
EMPTY_STRING |
static long |
PRICE_EXPONENT |
static long |
PRICE_MULTIPLIER |
static long |
QTY_EXPONENT |
static long |
QTY_MULTIPLIER |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.Boolean |
convert(mftrading.Boolean bool)
Converts from an SBE Boolean to a Java Boolean, or null if the value is not representable as a Boolean.
|
static void |
convertAndPad(java.lang.String source,
byte[] destination)
Copies a source String to the provided byte array - formatted as UTF-8.
|
static byte[] |
convertAndPad(java.lang.String source,
int size)
Copies a source String to a new byte array - formatted as UTF-8.
|
static double |
convertMantissaToPrice(long mantissa)
Converts a mantissa formatted price (used in the SBE methods) into a double.
|
static double |
convertMantissaToQuantity(long mantissa)
Converts a mantissa formatted quantity (used in the SBE methods) into a double.
|
static long |
convertPriceToMantissa(double price)
Converts a price to the Mantissa format required by some of the API methods.
|
static long |
convertQuantityToMantissa(double quantity)
Converts a quantity to the Mantissa format required by some of the API methods.
|
static long |
convertQuantityToMantissa(long quantity)
Converts a quantity to the Mantissa format required by some of the API methods.
|
static java.util.Date |
toDate(int daysPastEpoch,
int nullValue)
Deprecated.
Consider using the LocalDate variant of this converter
|
static int |
toDaysPastEpoch(java.time.LocalDate date)
Converts a LocalDate instance to epoch days.
|
static java.time.LocalDate |
toLocalDate(int daysPastEpoch,
int nullValue)
Convert specified number of days past epoch to a LocalDate object
|
static java.lang.String |
toString(byte[] buffer)
Convert an SBE text field to java String.
|
static java.lang.String |
toString(int daysPastEpoch,
int nullValue)
Convert number of days past epoch to a string for easy printing.
|
public static final java.lang.String EMPTY_STRING
public static final long QTY_EXPONENT
public static final long QTY_MULTIPLIER
public static final long PRICE_EXPONENT
public static final long PRICE_MULTIPLIER
public static java.lang.String toString(byte[] buffer)
public static java.lang.String toString(int daysPastEpoch,
int nullValue)
If the value is equal to the provided null value an empty string is returned.
daysPastEpoch - the number of days after epoch (Jan 1 1970)nullValue - the value that represents nullpublic static java.util.Date toDate(int daysPastEpoch,
int nullValue)
daysPastEpoch - the number of days after epoch (Jan 1 1970)nullValue - the value that represents nullpublic static java.time.LocalDate toLocalDate(int daysPastEpoch,
int nullValue)
daysPastEpoch - the number of days after epoch (Jan 1 1970)nullValue - the value that represents nullpublic static int toDaysPastEpoch(java.time.LocalDate date)
throws java.lang.IllegalArgumentException
date - to convert to days past epochjava.lang.IllegalArgumentExceptionpublic static long convertQuantityToMantissa(long quantity)
QTY_EXPONENT.quantity - quantity to convertpublic static long convertQuantityToMantissa(double quantity)
QTY_MULTIPLIER.
If your quantity has more than QTY_EXPONENT decimal places,
that information will be lost. There is no rounding.
quantity - quantity to convertpublic static long convertPriceToMantissa(double price)
PRICE_MULTIPLIER.
If your value has more than PRICE_EXPONENT decimal places,
then normal rounding will occur.
price - price to convertpublic static double convertMantissaToPrice(long mantissa)
PRICE_MULTIPLIER to produce the result.mantissa - price in mantissa formatpublic static double convertMantissaToQuantity(long mantissa)
QTY_MULTIPLIER to produce the result.mantissa - quantity to convert in mantissa formatpublic static java.lang.Boolean convert(mftrading.Boolean bool)
bool - SBE value to convertpublic static void convertAndPad(java.lang.String source,
byte[] destination)
IndexOutOfBoundsException will be
thrown.source - string to convertdestination - byte array to copy the source string's bytes intopublic static byte[] convertAndPad(java.lang.String source,
int size)
IndexOutOfBoundsException will be thrown.source - string to convertsize - size of the output byte array