public class SwiftFormatUtils extends Object
Constructor and Description |
---|
SwiftFormatUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getBIC(BIC bic)
Gets the code from the parameter BIC.
|
static BIC |
getBIC(String code) |
static String |
getBoolean(Boolean bool)
Parses a Boolean object into a string.
|
static Boolean |
getBoolean(String string)
Gets the given string as boolean.
|
static String |
getCurrency(Currency currency)
Gets the currency code from the parameter Currency.
|
static Currency |
getCurrency(String code)
Returns the
Currency instance for the given currency code. |
static String |
getDate1(Calendar date)
Parses a Calendar object into a DATE1 string.
|
static Calendar |
getDate1(String strDate)
Parses a DATE1 string (accept dates in format MMDD) into a Calendar object.
|
static String |
getDate2(Calendar date)
Parses a Calendar object into a DATE2 string.
|
static Calendar |
getDate2(String strDate)
Parses a DATE2 string (accept dates in format YYMMDD) into a Calendar object.
|
static String |
getDate3(Calendar date)
Parses a Calendar object into a DATE1 string.
|
static Calendar |
getDate3(String strDate)
Parses a DATE3 string (accept dates in format YYMM) into a Calendar object.
|
static String |
getDate4(Calendar date)
Parses a Calendar object into a DATE1 string.
|
static Calendar |
getDate4(String strDate)
Parses a DATE4 string (accept dates in format YYYYMMDD) into a Calendar object.
|
static String |
getDateTime(Calendar date)
Parses a Calendar object into a string containing the DATETIME with YYYYMMDDHHMM format.
|
static Calendar |
getDateTime(String strDate)
Parses a DATETIME string (accepts dates with time in YYYYMMDDHHMM format) into a Calendar object.
|
static String |
getDateTimeShortYear(Calendar date)
Parses a Calendar object into a DATETIME with short year string in YYMMDDHHMM format.
|
static Calendar |
getDateTimeShortYear(String strDate)
Parses a DATETIME with short year string (accepts dates with time in YYMMDDHHMM format) into a Calendar object.
|
static String |
getDayTime(Calendar date)
Parses a Calendar object into a string containing the DAYTIME in DDHHMM format.
|
static Calendar |
getDayTime(String strDate)
Parses a DAYTIME string (accepts dates with time in DDHHMM format) into a Calendar object.
|
static Calendar |
getHhmm(String hhmm) |
static String |
getHour(Calendar date)
Parses a Calendar object into a string containing the HOUR in HH format.
|
static Calendar |
getHour(String strDate)
Parses an HOUR string (accepts time in HH format) into a Calendar object.
|
static String |
getMIR(MIR mir)
Parses a MIR object into a string containing its serialized data.
|
static MIR |
getMIR(String value)
Parses a string value into a MIR object.
|
static String |
getMonthDay(Calendar date)
Parses a Calendar object into a string containing MONTHDAY in MMDD format.
|
static Calendar |
getMonthDay(String strDate)
Parses a MONTHDAY string (accepts dates in MMDD format) into a Calendar object.
|
static String |
getMOR(MOR mor)
Parses a MOR object into a string containing its serialized data.
|
static MOR |
getMOR(String value)
Parses a string value into a MOR object.
|
static String |
getNumber(Number number)
Parses a Number into a SWIFT string number ####,## where trunked zero decimals and mandatory decimal separator.
|
static Number |
getNumber(String amount)
Parses a value into a java Number (BigDecimal) using the comma for decimal separator.
|
static String |
getOffset(Calendar date)
Parses a Calendar object into a offset string.
|
static Calendar |
getOffset(String string) |
static Character |
getSign(String string) |
static String |
getTime2(Calendar date)
Parses a Calendar object into a TIME2 string.
|
static Calendar |
getTime2(String hhmmss) |
static String |
getTime3(Calendar date)
Parses a Calendar object into a TIME3 string.
|
static Calendar |
getTime3(String hhmmss) |
static String |
getYear(Calendar date)
Parses a Calendar object into a YYYY string.
|
static Calendar |
getYear(String strDate)
Parses a YEAR string (accept dates in format YYYY) into a Calendar object.
|
static boolean |
isCurrency(String string)
Tell if
string is a valid currency code |
public static Calendar getDate2(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDate2(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getDate1(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDate1(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getDate3(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDate3(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getDate4(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDate4(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getYear(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getYear(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Number getNumber(String amount)
amount
- to parsenull
if the number could not be parsedpublic static String getNumber(Number number)
number
- to parsenull
if the number is nullpublic static Calendar getHhmm(String hhmm)
hhmm
- hour and minutespublic static Calendar getTime2(String hhmmss)
hhmmss
- hour, minutes and secondspublic static String getTime2(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getTime3(String hhmmss)
hhmmss
- hour, minutes and secondspublic static String getTime3(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Character getSign(String string)
string
- with a single characterpublic static Calendar getOffset(String string)
string
- with an offsetpublic static String getOffset(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Currency getCurrency(String code)
Currency
instance for the given currency code.code
- string with a currency codeIllegalArgumentException
- if currencyCode is not a supported ISO 4217 code.public static String getCurrency(Currency currency)
currency
- Currency to usepublic static BIC getBIC(String code)
code
- string with a BIC codepublic static String getBIC(BIC bic)
bic
- BIC to usepublic static Boolean getBoolean(String string)
string
- code to use where the expected values are "Y" or "N"null
otherwisepublic static String getBoolean(Boolean bool)
bool
- Boolean to parsenull
if the boolean object is nullpublic static Calendar getDateTime(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDateTime(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getDateTimeShortYear(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDateTimeShortYear(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getDayTime(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getDayTime(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getMonthDay(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getMonthDay(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static Calendar getHour(String strDate)
strDate
- string to parsenull
if the argument did not matched the expected date formatpublic static String getHour(Calendar date)
date
- Calendar to parsenull
if the calendar is nullpublic static MIR getMIR(String value)
value
- string containing the complete MIR valuenull
if the argument is not a 28 length string with a proper MIR dataMIR
public static String getMIR(MIR mir)
mir
- MIR to processnull
if the parameter is empty or null
MIR.getMIR()
public static MOR getMOR(String value)
value
- string containing the complete MOR valuenull
if the argument is not a 28 length string with a proper MOR dataMOR
public static String getMOR(MOR mor)
mor
- MOR to processnull
if the parameter is empty or null
MOR.getMOR()
public static boolean isCurrency(String string)
string
is a valid currency codestring
- the string to test for a currency code