public final class ConversionUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DATE_FORMAT |
Constructor and Description |
---|
ConversionUtils() |
Modifier and Type | Method and Description |
---|---|
static BigDecimal |
add(Double v1,
Double v2) |
static BigDecimal |
asBigDecimal(Double dbl)
Converts double value to BigDecimal
|
static Date |
asDate(XMLGregorianCalendar xgc)
Converts an XMLGregorianCalendar to an instance of java.util.Date
|
static XMLGregorianCalendar |
asXMLGregorianCalendar(Date date)
Converts a java.util.Date into an instance of XMLGregorianCalendar
|
static XMLGregorianCalendar |
asXMLGregorianCalendarTime(Date date)
Converts a java.util.Date into an instance of XMLGregorianCalendar
|
static XMLGregorianCalendar |
asXMLGregorianCalendarTimeWithoutZone(Date date)
As xml gregorian calendar time without zone.
|
static String |
formatText(String text,
Map<String,String> values)
Format text containing variables surrounded by braces using the values supplied.
|
static String |
getEHFV3TaxCategoryCode(Double taxPercent,
String taxCode) |
static byte[] |
getFileAsByteArray(InputStream is)
Gets the file stream as byte array.
|
static BigDecimal |
getRoundingAmount(BigDecimal amount) |
static BigDecimal |
getRoundingAmount(Double amount)
Gets the rounding amount.
|
static String |
getTaxCategoryCode(Double taxPercent)
Get tax category id.
|
static String |
removeEmptySpaces(String value) |
static double |
round(double value,
int places)
Round value to the specified number of decimals.
|
static String |
stripNonAlphaNumeric(String value) |
public static final String DATE_FORMAT
public static XMLGregorianCalendar asXMLGregorianCalendar(Date date)
date
- Instance of java.util.Date or a null referencepublic static XMLGregorianCalendar asXMLGregorianCalendarTime(Date date)
date
- Instance of java.util.Date or a null referencepublic static XMLGregorianCalendar asXMLGregorianCalendarTimeWithoutZone(Date date)
date
- the datepublic static Date asDate(XMLGregorianCalendar xgc)
xgc
- Instance of XMLGregorianCalendar or a null referencepublic static BigDecimal asBigDecimal(Double dbl)
dbl
- public static String getTaxCategoryCode(Double taxPercent)
taxPercent
- public static String getEHFV3TaxCategoryCode(Double taxPercent, String taxCode)
public static byte[] getFileAsByteArray(InputStream is) throws IOException
is
- the file input streamIOException
- Signals that an I/O exception has occurred.public static BigDecimal getRoundingAmount(Double amount)
amount
- the amountpublic static BigDecimal getRoundingAmount(BigDecimal amount)
public static BigDecimal add(Double v1, Double v2)
public static double round(double value, int places)
value
- the valueplaces
- the decimal placespublic static String formatText(String text, Map<String,String> values)
text
- the text to be formattedvalues
- the values to be replacedCopyright © 2021 Norwegian Agency for Public Management and eGovernment (Difi). All rights reserved.