public class CommonUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID_SEPARATOR |
static java.util.Locale |
LOCALE_DE_CH |
static java.lang.String |
PATTERN_DATE_DATE |
static java.lang.String |
PATTERN_DATE_DATE_WITHOUT_YEAR |
static java.lang.String |
PATTERN_DATE_ENGLISH |
static java.lang.String |
PATTERN_DATE_FULL |
static java.lang.String |
PATTERN_DATE_GERMAN |
static java.lang.String |
PATTERN_DATE_GERMAN_FIGURES |
static java.lang.String |
PATTERN_DATE_GERMAN_FOR_TEXT |
static java.lang.String |
PATTERN_DATE_GERMAN_LONG |
static java.lang.String |
PATTERN_DATE_GERMAN_LONG_NICE |
static java.lang.String |
PATTERN_DATE_GERMAN_SHORT_YEAR |
static java.lang.String |
PATTERN_DATE_LONG |
static java.lang.String |
PATTERN_DATE_MONTH_YEAR |
static java.lang.String |
PATTERN_DATE_MONTH_YEAR_DB |
static java.lang.String |
PATTERN_DATE_MONTH_YEAR_LONG |
static java.lang.String |
PATTERN_DATE_MONTH_YEAR_SHORT |
static java.lang.String |
PATTERN_DATE_SHORTTIME_GERMAN |
static java.lang.String |
PATTERN_DATE_TIME_ENGLISH |
static java.lang.String |
PATTERN_DATE_TIME_GERMAN |
static java.lang.String |
PATTERN_DATE_TIME_WITH_MILLIS_GERMAN |
static java.lang.String |
PATTERN_DATE_YEAR |
static java.lang.String |
PATTERN_TIME_HHMM |
static java.lang.String |
PATTERN_TIME_HHMMSS |
static java.lang.String |
UNDEF_VALUE_TEXT |
Constructor and Description |
---|
CommonUtils() |
Modifier and Type | Method and Description |
---|---|
static java.math.BigDecimal |
addBDToTotal(java.math.BigDecimal oldTotal,
java.math.BigDecimal value) |
static java.util.Date |
addDate(java.util.Date date,
int field,
int value)
Adds value to given date's field
|
static java.lang.Double |
addDoubleToTotal(java.lang.Double oldTotal,
java.lang.Double value) |
static java.lang.Integer |
addIntegerToTotal(java.lang.Integer oldTotal,
java.lang.Integer value) |
static java.lang.Double |
addRoundedDoubleToTotal(java.lang.Double oldTotal,
java.lang.Double value,
java.lang.Integer decimalPlaces) |
static java.util.Date |
addSeconds(java.util.Date date,
int seconds)
Add seconds to date.
|
static boolean |
areDatesOverlapping(java.util.Date dateFrom,
java.util.Date dateTo,
java.util.Date dateFromToCheck,
java.util.Date dateToToCheck) |
static int |
compareDateAndTimes(java.util.Date date1,
java.util.Date date2)
Compares dates.
|
static int |
compareDates(java.util.Date date1,
java.util.Date date2)
Compares dates, time is reset.
|
static boolean |
compareMinutes(java.lang.Integer minutes,
java.lang.Integer minutes2) |
static int |
compareTimes(java.util.Date date1,
java.util.Date date2)
Compares times.
|
static boolean |
compareYearAndMonth(java.util.Date date1,
java.util.Date date2)
Compares if dates have the same year and month.
|
static java.math.BigDecimal |
convertDoubleToBigDecimal(double value)
Stupid conversion fix to avoid problems.
|
static java.lang.Integer |
convertHoursToMinutes(java.lang.Double hours)
Converts
Double hours value to Integer minutes. |
static java.lang.Integer |
convertHoursToSecondes(java.lang.Double hours)
Converts
Double hours value to Integer minutes. |
static java.lang.String |
convertIds(java.util.List<java.lang.Integer> ids)
Converts list of IDs to one string where IDs are separated by comma character.
|
static java.lang.Double |
convertMinutesToHours(java.lang.Integer minutes)
Converts
Integer minutes value to Integer hours. |
static java.util.ArrayList<java.lang.String> |
convertToList(java.lang.String str)
Converts string to list of Strings where Strings are separated by comma character.
|
static java.util.Date |
convertXMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar calendar) |
static java.util.Date |
convertXMLGregorianCalendarForFromDate(javax.xml.datatype.XMLGregorianCalendar calendar) |
static java.util.Date |
convertXMLGregorianCalendarForToDate(javax.xml.datatype.XMLGregorianCalendar calendar) |
static java.util.Date |
copyTimeToDate(java.util.Date date,
java.util.Date time)
Copy only the time of one date to the date of another date.
|
static java.lang.String |
divideAndFormatBD(java.math.BigDecimal value1,
java.math.BigDecimal value2) |
static java.lang.String |
divideAndFormatBDToPercent(java.math.BigDecimal value1,
java.math.BigDecimal value2,
boolean showPercentCharacter) |
static java.lang.String |
divideAndFormatDouble(java.lang.Double value1,
java.lang.Double value2) |
static java.lang.String |
divideAndFormatDoubleToPercent(java.lang.Double value1,
java.lang.Double value2,
boolean showPercentCharacter) |
static java.math.BigDecimal |
divideBD(java.math.BigDecimal value1,
java.math.BigDecimal value2) |
static java.lang.Double |
divideBDToPercent(java.math.BigDecimal value1,
java.math.BigDecimal value2) |
static java.lang.Double |
divideDouble(java.lang.Double value1,
java.lang.Double value2) |
static java.lang.Double |
divideInteger(java.lang.Integer value1,
java.lang.Integer value2) |
static java.lang.String |
formatBigDecimal(java.math.BigDecimal value,
java.lang.Integer maxFractionDigits)
format a BigDecimal
|
static java.lang.String |
formatBigDecimal(java.math.BigDecimal value,
java.lang.Integer minFractionDigits,
java.lang.Integer maxFractionDigits)
Formats
BigDecimal value using LOCALE_DE_CH locale. |
static java.lang.String |
formatDouble(java.lang.Double value,
java.lang.Integer maxFractionDigits)
Format a Double
|
static java.lang.String |
formatDouble(java.lang.Double value,
java.lang.Integer minFractionDigits,
java.lang.Integer maxFractionDigits)
Formats
BigDecimal value using LOCALE_DE_CH locale. |
static java.lang.String |
formatDoubleToCurrency(java.lang.Double value) |
static java.lang.String |
formatDoubleToKm(java.lang.Double value) |
static java.lang.String |
formatLong(java.lang.Long value)
Formats
Long value using LOCALE_DE_CH locale. |
static java.lang.String |
formatWeekYear(java.util.Date weekYearDate)
Because of java 1.6 bugs for week formatting in simple date format...
|
static java.util.Date |
get18Birthday(java.util.Date date)
calculate birthday for 18 years old
|
static java.util.Date |
getActualApplDateWithFallback()
get the actual Application date
|
static java.util.Date |
getActualSystemTime()
get the actual system time
|
static int |
getActualWeek()
get actual week
|
static java.util.Date |
getApplInfiniteDate()
Returns ('2099-12-31').
|
static java.util.Date |
getApplMaxDate()
Returns application's greatest date ('9999-12-31').
|
static java.util.Date |
getApplMinDate()
Returns application's lowest date ('1900-01-01').
|
static java.util.Date |
getBirthday(java.util.Date date,
int yearsToAdd)
calculate birthday for parameter year
|
static boolean |
getBooleanFromInt(int value)
get the boolean value from the given int
|
static boolean |
getBooleanFromInteger(java.lang.Integer value)
get the boolean value from the given integer
|
static boolean |
getBooleanFromText(java.lang.String value)
get the boolean value from the passed text of the TRUE or FALSE constant
|
static java.util.Calendar |
getCalendar() |
static java.util.Calendar |
getCalendar(java.util.Date date)
get a calendar for given date
|
static java.util.Calendar |
getCalendar(long timeInMillis)
get a calendar for given date
|
static java.util.Date |
getCurrentBirthday(java.util.Date date)
calculate birthday for current year
|
static java.util.Date |
getDate(int year,
int month,
int day) |
static java.util.Date |
getDate(int year,
int month,
int day,
int hour,
int minutes)
Sets the values for the calendar fields
YEAR , MONTH , DAY_OF_MONTH ,
HOUR_OF_DAY , and MINUTE . |
static java.util.Date |
getDate(long timeInMillis)
get a date for given time in millis
|
static java.lang.Integer |
getDateFieldValue(java.util.Date date,
int field)
Gets value of given date field
|
static java.lang.String |
getDateFormatted(java.util.Date date,
java.lang.String pattern,
java.util.Locale locale)
formats given date to given pattern
|
static java.lang.String |
getDateFormattedDateTimeEnglish(java.util.Date date)
Return a date representing the date string PATTERN_DATE_TIME_ENGLISH (yyyy-MM-dd HH:mm:ss)
|
static java.lang.String |
getDateFormattedDD_MMMM_YYYY(java.util.Date date,
java.util.Locale locale)
formats given date to pattern dd MMMM yyyy
|
static java.lang.String |
getDateFormattedLong(java.util.Date date,
java.util.Locale locale)
formats given date to pattern EEEE dd.MM.yyyy
|
static java.lang.String |
getDateFormattedLongNice(java.util.Date date,
java.util.Locale locale)
formats given date to pattern d.
|
static java.lang.String |
getDateFormattedMMMM_YYYY(java.util.Date date,
java.util.Locale locale)
formats given date to pattern MMMM yyyy
|
static java.util.Date |
getDateRoundXMinutes(java.util.Date date,
int intervalMinutes) |
static java.lang.String |
getDatesFormatted(java.util.Collection<java.util.Date> dates,
java.lang.String pattern,
java.util.Locale locale)
formats given dates to comma separated with pattern dd.MM.yyyy
|
static java.util.Date |
getDateSum(java.util.Date date,
java.util.Date time)
get the date of given date and time
|
static java.util.Date |
getDateSumCheckMidnight(java.util.Date date,
java.util.Date time)
get the date of given date and time
|
static java.util.Date |
getDateSumCheckMidnightView(java.util.Date date,
java.util.Date time) |
static java.util.Date |
getDateWithMinutesOffset(java.util.Date date,
int minutesOffset)
add/subtract minutesOffset for the given date
|
static java.util.Date |
getDateWithOffset(java.util.Date date,
int daysOffset)
add/subtract daysOffset for the given date
|
static java.util.Date |
getDateWithOffset(java.util.Date date,
int field,
int value)
get date with offset
|
static java.util.Date |
getDateWithOffset(int daysOffset)
for the current date x days should be added
|
static java.util.Date |
getDateWithoutSeconds(java.util.Date date)
HH:mm:00,000 of the given date +/- offset
|
static java.util.Date |
getDateWithoutTime(java.util.Date date) |
static int |
getDay(java.util.Date date)
get day of date
|
static int |
getDayOfWeek(java.util.Date date)
get (java) week day of given date
|
static java.util.List<java.util.Date> |
getDaysInPeriod(java.util.Date startDate,
java.util.Date endDate,
java.util.List<java.lang.Integer> excludedDaysInWeek,
java.util.List<java.lang.Integer> includedDaysInWeek)
Get days in a period
|
static java.lang.Double |
getDouble(java.lang.String value)
Returns the number value of the string
|
static double |
getDoubleOrZero(java.lang.Double value)
Returns the number value of the string
|
static java.util.Date |
getEndOfDay(java.util.Date date)
23:59:59,999 of the passed date
|
static java.util.Date |
getEndOfDay(java.util.Date date,
int daysOffset)
23:59:59,999 of the passed date +/- offset
|
static java.util.Date |
getEndOfHour(java.util.Date date)
Introduce passed date at the end of the hour
|
static java.util.Date |
getEndOfMonth()
get date of last millisecond of the actual (applDate) month
|
static java.util.Date |
getEndOfMonth(java.util.Date date)
Get end of month
|
static java.util.Date |
getEndOfMonth(java.util.Date date,
int offsetMonth)
Get end of month with offset
|
static java.util.Date |
getEndOfMonth(java.lang.String monthYear)
Get end of month
|
static java.util.Date |
getEndOfNextMonth()
get last day of next month (of applDate)
|
static java.util.Date |
getEndOfNextYear()
Get end of next year
|
static java.util.Date |
getEndOfNextYear(java.util.Date date)
Get end of next year
|
static java.util.Date |
getEndOfPreviousMonth()
get last millisecond of previous month (of applDate)
|
static java.util.Date |
getEndOfPreviousMonth(java.util.Date date)
Get end of previous month
|
static java.util.Date |
getEndOfPreviousYear()
Get end of previous year
|
static java.util.Date |
getEndOfPreviousYear(java.util.Date date)
Get end of previous year
|
static java.util.Date |
getEndOfWeek()
last day of actual (appldate) week
|
static java.util.Date |
getEndOfWeek(java.util.Date date)
last day of week for given date
|
static java.util.Date |
getEndOfYear()
Get end of year
|
static java.util.Date |
getEndOfYear(java.util.Date date)
Get end of year
|
static java.util.Date |
getEndOfYear(java.util.Date date,
int offsetYear)
Get end of year with offset
|
static java.lang.String |
getFormattedDurationOfMs(long milliseconds)
Creates a string which breaks down a given millisecond into hours, minutes and seconds.
|
static java.lang.String |
getFormattedHHMMOfMinutes(int durationInMinutes)
Get minutes as formatted hours and minutes
|
static java.lang.String |
getFormattedHHOfMinutes(int durationInMinutes)
Get minutes as formatted hours
|
static int |
getHours(java.util.Date date) |
static java.lang.Integer |
getInteger(java.lang.String value)
Returns the number value of the string
|
static java.lang.Integer |
getIntegerWithFallback(java.lang.String value,
int fallback)
returns the number value of the string with fallback
|
static int |
getIntFromBoolean(java.lang.Boolean value)
get the int value for TRUE or FALSE
|
static int |
getIntOrZero(java.lang.Integer value)
Returns the number value of the string
|
static int |
getLastWeekInMonth(java.util.Calendar lastDayOfMonth) |
static int |
getLastWeekInMonth(java.util.Date date) |
static java.lang.Long |
getLongWithFallback(java.lang.String value,
long fallback)
gets the long value of given string with fallback 0
|
static java.lang.String |
getMD5(java.lang.String passwd)
Create MD5Hash
|
static int |
getMinutes(java.util.Date date)
get year of given date
|
static java.lang.Integer |
getMinutesFormattedFromTime(java.util.Date date)
returns time in minutes
|
static int |
getMonth(java.util.Date date)
get real month of date
|
static java.lang.Object |
getNestedValue(java.util.Map map,
java.lang.String... keys) |
static java.util.Date |
getNextBirthday(java.util.Date date)
calculate the next birthday
|
static java.util.Date |
getNextDay(java.util.Date date)
get next day
|
static java.util.Date |
getNextMonday(java.util.Date date) |
static java.util.Date |
getNextWorkingDate(java.util.Date date) |
static java.lang.Integer |
getNumberOfDaysBetweenDates(java.util.Date d1,
java.util.Date d2)
Gets number of days between two dates.
|
static java.util.Date |
getPreviousDay(java.util.Date date)
get previous day
|
static java.util.Date |
getPreviousDay(java.util.Date date,
int day) |
static java.util.Date |
getPreviousWorkingDate(java.util.Date date) |
static java.lang.String |
getPropertyWithFallback(java.util.Properties properties,
java.lang.String propertyName,
java.lang.String fallback)
get config property of config file
|
static java.util.Date |
getSameWeekDayLastYear(java.util.Date calendarDate) |
static java.lang.String |
getStackTrace(java.lang.Throwable error)
Determines the track trace to the exception
|
static java.util.Date |
getStartOfAfternoon(java.util.Date date)
Get start time of afternoon
|
static java.util.Date |
getStartOfAfternoon(java.util.Date date,
int daysOffset)
0:00:00,000 of the passed date +/- offset
|
static java.util.Date |
getStartOfDay(java.util.Date date)
Get start of day
|
static java.util.Date |
getStartOfDay(java.util.Date date,
int daysOffset)
0:00:00,000 of the passed date +/- offset
|
static java.util.Date |
getStartOfHour(java.util.Date date)
Reset passed date to start of hour
|
static java.util.Date |
getStartOfMonth()
first day of actual (applDate) month
|
static java.util.Date |
getStartOfMonth(java.util.Date date)
get start of month of given date
|
static java.util.Date |
getStartOfMonth(java.util.Date date,
int offsetMonth)
get start of month of given date with given year offset
|
static java.util.Date |
getStartOfMonth(java.lang.String monthYear)
Get start of month
|
static java.util.Date |
getStartOfNextMonth()
first day of next month (of appldate)
|
static java.util.Date |
getStartOfNextMonth(java.util.Date date)
first day of next month for given date
|
static java.util.Date |
getStartOfNextYear()
first day of next (applDate) year
|
static java.util.Date |
getStartOfNextYear(java.util.Date date)
first day of next year
|
static java.util.Date |
getStartOfPreviousMonth()
first day of previous month (of applDate)
|
static java.util.Date |
getStartOfPreviousMonth(java.util.Date date)
first day of previous month for given date
|
static java.util.Date |
getStartOfPreviousYear()
first day of previous (applDate) year
|
static java.util.Date |
getStartOfWeek()
first day of actual (applDate) week
|
static java.util.Date |
getStartOfWeek(java.util.Date date)
first day of week for the given date
|
static java.util.Date |
getStartOfYear()
first day of actual (applDate) year
|
static java.util.Date |
getStartOfYear(java.util.Date date)
get start of year of given date
|
static java.util.Date |
getStartOfYear(java.util.Date date,
int offsetYear)
get start of year of given date with given year offset
|
static java.util.Date |
getStartOfYearYYYY(java.lang.Integer year)
Get start of year of given year
|
static java.lang.String |
getTextFromBoolean(java.lang.Boolean value)
get the text value for TRUE or FALSE
|
static java.util.Date |
getTime(java.util.Date date)
removes the date value from given date and returns the time (with date 1.1.1970)
|
static java.util.Date |
getTime(int hour,
int minute) |
static java.util.Date |
getTime(int hour,
int minute,
int second) |
static java.lang.Integer |
getTimeDiffInMinutes(java.util.Date from,
java.util.Date to) |
static java.lang.String |
getTimeFormatted(double value)
returns the parameter double as it was formatted as Time.getInputtedTimeFormatted()
|
static java.lang.String |
getTimeFormatted(java.lang.String value)
returns the parameter double as it was formatted as Time.getInputtedTimeFormatted()
|
static java.lang.String |
getTimeFormattedFromMinutes(java.lang.Integer minutes,
java.util.Locale locale)
returns formatted Time from number of minutes
|
static java.util.Date |
getTimeMidnightView(java.util.Date time) |
static int |
getWeek(java.util.Date date)
fetches the week from the given date
|
static int |
getYear()
get actual year
|
static int |
getYear(java.util.Date date)
get year of given date
|
static boolean |
isAfterOfEquals(java.util.Date first,
java.util.Date second)
checks if the first value ist after or euqals the second value
returns false if one is null
|
static boolean |
isBeforeOrEquals(java.util.Date first,
java.util.Date second)
checks if the first value ist before or equals the second value
returns false if one is null
|
static boolean |
isDateInPeriod(java.util.Date dateFrom,
java.util.Date dateTo,
java.util.Date dateToCheck)
checks, if a given date is in a given period
|
static boolean |
isFriday(java.util.Calendar dateToCheck)
checks if the day is friday
|
static boolean |
isFriday(java.util.Date dateToCheck)
checks if the day is friday
|
static boolean |
isGivenDayOfWeek(java.util.Date date,
int dayOfWeek)
is date given day of week
|
static boolean |
isInGivenDates(java.util.List<java.util.Date> validDates,
java.util.Date dataDate)
Compares whether date's value is in list of values.
|
static boolean |
isMonday(java.util.Calendar dateToCheck)
checks if the day is monday
|
static boolean |
isMonday(java.util.Date dateToCheck)
checks if the day is monday
|
static boolean |
isSameDay(java.util.Date date1,
java.util.Date date2)
Compares, if dates have the same day, month and year.
|
static boolean |
isSameDay(java.util.Date date1,
java.util.Date date2,
boolean checkMidnight)
Compares, if dates have the same day, month and year.
|
static boolean |
isSameMonth(java.util.Date date1,
java.util.Date date2)
Compares, if dates have the same year.
|
static boolean |
isSameYear(java.util.Date date1,
java.util.Date date2)
Compares, if dates have the same year.
|
static boolean |
isSaturday(java.util.Calendar dateToCheck)
checks if the day is saturday
|
static boolean |
isSaturday(java.util.Date dateToCheck)
checks if the day is saturday
|
static boolean |
isSunday(java.util.Calendar dateToCheck)
checks if the day is sunday
|
static boolean |
isSunday(java.util.Date dateToCheck)
checks if the day is sunday
|
static boolean |
isThursday(java.util.Calendar dateToCheck)
checks if the day is thursday
|
static boolean |
isThursday(java.util.Date dateToCheck)
checks if the day is thursday
|
static boolean |
isWeekendDay(java.util.Date dateToCheck)
checks if the day is on saturday or sunday
|
static java.lang.String |
lpad(java.lang.String input,
char padding,
int length)
Padds the string to the left with the given character for the specified length.
|
static java.util.Date |
parseDate(java.lang.String dateStr)
Return a date representing the date string
|
static java.util.Date |
parseDate(java.lang.String date,
java.lang.String pattern,
java.util.Locale locale)
parses the given date-string with given format to a date
|
static java.util.Date |
parseDateDateTimeEnglish(java.lang.String dateStr)
Return a date representing the date string PATTERN_DATE_TIME_ENGLISH (yyyy-MM-dd HH:mm:ss)
|
static java.util.Date |
parseTimeHHMM(java.lang.String timeString,
java.util.Locale locale)
parses the given String to date; expects pattern "HH:mm"
|
static java.util.Date |
parseTimeHHMMSS(java.lang.String timeString,
java.util.Locale locale)
parses the given String to date; expects pattern "HH:mm:ss"
|
static java.util.Date |
parseWeekYear(java.lang.String weekYear)
Because of java 1.6 bugs for week formatting in simple date format...
|
static java.lang.String |
reverse(java.lang.String source) |
static java.lang.Double |
roundAmount(java.lang.Double value,
int decimalPlaces)
Rounds value on specific number of decimal places
|
static java.lang.String |
roundAndFormatDouble(java.lang.Double value) |
static java.lang.String |
roundAndFormatDouble(java.lang.Double value,
int fractionDigits)
round given double value with given to fractionDigits positions and format it with fractionDigits
|
static java.lang.Double |
roundDouble(java.lang.Double value,
int decimalPlaces)
Rounds value on specific number of decimal places
|
static java.lang.String |
rpad(java.lang.String input,
char padding,
int length)
Padds the string to the right with the given character for the specified length.
|
static java.lang.String |
substring(java.lang.String str,
int beginIndex,
int endIndex)
Return the string substring or blank when not possible.
|
static java.lang.String |
trimString(java.lang.String value)
Trim the input value
|
static java.lang.String |
truncateString(java.lang.String str,
int maxLength)
Truncates string to maxLength.
|
public static java.lang.String PATTERN_DATE_GERMAN
public static java.lang.String PATTERN_DATE_GERMAN_SHORT_YEAR
public static java.lang.String PATTERN_DATE_GERMAN_FIGURES
public static java.lang.String PATTERN_DATE_GERMAN_FOR_TEXT
public static java.lang.String PATTERN_DATE_TIME_GERMAN
public static java.lang.String PATTERN_DATE_SHORTTIME_GERMAN
public static java.lang.String PATTERN_DATE_TIME_WITH_MILLIS_GERMAN
public static java.lang.String PATTERN_DATE_DATE
public static java.lang.String PATTERN_DATE_DATE_WITHOUT_YEAR
public static java.lang.String PATTERN_DATE_GERMAN_LONG
public static java.lang.String PATTERN_DATE_LONG
public static java.lang.String PATTERN_DATE_GERMAN_LONG_NICE
public static java.lang.String PATTERN_DATE_FULL
public static java.lang.String PATTERN_TIME_HHMM
public static java.lang.String PATTERN_TIME_HHMMSS
public static java.lang.String PATTERN_DATE_ENGLISH
public static java.lang.String PATTERN_DATE_TIME_ENGLISH
public static java.util.Locale LOCALE_DE_CH
public static java.lang.String PATTERN_DATE_MONTH_YEAR
public static java.lang.String PATTERN_DATE_MONTH_YEAR_SHORT
public static java.lang.String PATTERN_DATE_MONTH_YEAR_LONG
public static java.lang.String PATTERN_DATE_YEAR
public static java.lang.String PATTERN_DATE_MONTH_YEAR_DB
public static final java.lang.String ID_SEPARATOR
public static final java.lang.String UNDEF_VALUE_TEXT
public static java.lang.String getMD5(java.lang.String passwd) throws java.security.NoSuchAlgorithmException
passwd
- to be hasedjava.security.NoSuchAlgorithmException
- as exceptionpublic static java.lang.String getFormattedDurationOfMs(long milliseconds)
milliseconds
- as longpublic static java.lang.String getFormattedHHMMOfMinutes(int durationInMinutes)
durationInMinutes
- as intpublic static java.lang.String getFormattedHHOfMinutes(int durationInMinutes)
durationInMinutes
- as intpublic static java.util.Date getActualApplDateWithFallback()
public static java.util.Date getActualSystemTime()
public static java.util.Date getStartOfDay(java.util.Date date)
date
- to be set to 0public static java.util.Date getStartOfAfternoon(java.util.Date date)
date
- to be set to 12:00public static java.util.Date getStartOfMonth(java.lang.String monthYear)
monthYear
- format: yyyymmpublic static java.util.Date getStartOfMonth(java.util.Date date)
date
- as given datepublic static java.util.Date getStartOfMonth(java.util.Date date, int offsetMonth)
date
- as given dateoffsetMonth
- as offset valuepublic static java.util.Date getStartOfYear()
public static java.util.Date getStartOfPreviousYear()
public static java.util.Date getStartOfNextYear()
public static java.util.Date getStartOfNextYear(java.util.Date date)
date
- as given datepublic static java.util.Date getStartOfYear(java.util.Date date)
date
- as given datepublic static java.util.Date getStartOfYear(java.util.Date date, int offsetYear)
date
- as given dateoffsetYear
- as given offsetpublic static java.util.Date getStartOfYearYYYY(java.lang.Integer year)
year
- as given yearpublic static java.util.Date getEndOfMonth(java.lang.String monthYear)
monthYear
- format: yyyymmpublic static java.util.Date getEndOfMonth(java.util.Date date)
date
- as given datepublic static java.util.Date getEndOfPreviousMonth(java.util.Date date)
date
- as given datepublic static java.util.Date getEndOfMonth(java.util.Date date, int offsetMonth)
date
- as given dateoffsetMonth
- as given offsetpublic static java.util.Date getEndOfYear()
public static java.util.Date getEndOfYear(java.util.Date date)
date
- as given datepublic static java.util.Date getEndOfPreviousYear()
public static java.util.Date getEndOfPreviousYear(java.util.Date date)
date
- as given datepublic static java.util.Date getEndOfNextYear()
public static java.util.Date getEndOfNextYear(java.util.Date date)
date
- as given datepublic static java.util.Date getEndOfYear(java.util.Date date, int offsetYear)
date
- as given dateoffsetYear
- as offsetpublic static java.util.Date convertXMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar calendar)
public static java.util.Date convertXMLGregorianCalendarForFromDate(javax.xml.datatype.XMLGregorianCalendar calendar)
public static java.util.Date convertXMLGregorianCalendarForToDate(javax.xml.datatype.XMLGregorianCalendar calendar)
public static java.util.Calendar getCalendar()
public static java.util.Calendar getCalendar(java.util.Date date)
date
- representing a datepublic static java.util.Calendar getCalendar(long timeInMillis)
timeInMillis
- representing a longpublic static java.util.Date getStartOfHour(java.util.Date date)
date
- representing a datepublic static java.util.Date getStartOfDay(java.util.Date date, int daysOffset)
date
- for this date the time should be set to 0 o'clockdaysOffset
- so many days in future or pastpublic static java.util.Date getStartOfAfternoon(java.util.Date date, int daysOffset)
date
- for this date the time should be set to 12:00 o'clockdaysOffset
- so many days in future or pastpublic static java.util.Date getEndOfDay(java.util.Date date)
date
- for this date the time is to be set to 23:59:59 clockpublic static java.util.Date getNextDay(java.util.Date date)
date
- for this day next date is requestedpublic static java.util.Date getPreviousDay(java.util.Date date)
date
- representing a datepublic static java.util.Date getPreviousDay(java.util.Date date, int day)
public static java.util.Date getDateWithOffset(int daysOffset)
daysOffset
- so many days in future or pastpublic static java.util.Date getDateWithOffset(java.util.Date date, int daysOffset)
date
- representing a datedaysOffset
- so many days in future or pastpublic static java.util.Date getDateWithMinutesOffset(java.util.Date date, int minutesOffset)
date
- representing a dateminutesOffset
- so many minutes in future or pastpublic static java.util.Date getDateWithOffset(java.util.Date date, int field, int value)
date
- for this date a value is to be addedfield
- for this date fieldvalue
- so many x in the future or pastpublic static java.util.Date getEndOfDay(java.util.Date date, int daysOffset)
date
- for this date the time should be set to 23:59:59daysOffset
- so many days in future or pastpublic static java.util.Date getEndOfHour(java.util.Date date)
date
- representing a datepublic static java.util.Date getCurrentBirthday(java.util.Date date)
date
- representing a datepublic static java.util.Date get18Birthday(java.util.Date date)
date
- representing a datepublic static java.util.Date getBirthday(java.util.Date date, int yearsToAdd)
date
- representing a dateyearsToAdd
- as intpublic static java.util.Date getNextBirthday(java.util.Date date)
date
- representing a datepublic static java.util.Date getStartOfWeek()
public static java.util.Date getStartOfWeek(java.util.Date date)
date
- representing a datepublic static java.util.Date getStartOfMonth()
public static java.util.Date getStartOfNextMonth()
public static java.util.Date getStartOfNextMonth(java.util.Date date)
date
- representing a datepublic static java.util.Date getStartOfPreviousMonth()
public static java.util.Date getStartOfPreviousMonth(java.util.Date date)
date
- representing a datepublic static java.util.Date getEndOfWeek()
public static java.util.Date getEndOfWeek(java.util.Date date)
date
- representing a datepublic static java.util.Date getEndOfMonth()
public static java.util.Date getEndOfNextMonth()
public static java.util.Date getEndOfPreviousMonth()
public static int getMonth(java.util.Date date)
date
- representing a datepublic static int getDay(java.util.Date date)
date
- representing a datepublic static int getDayOfWeek(java.util.Date date)
date
- representing a datepublic static int getActualWeek()
public static int getWeek(java.util.Date date)
date
- representing a datepublic static int getYear()
public static int getYear(java.util.Date date)
date
- representing a datepublic static int getMinutes(java.util.Date date)
date
- representing a datepublic static int getHours(java.util.Date date)
public static java.util.Date getDateRoundXMinutes(java.util.Date date, int intervalMinutes)
public static java.lang.String getDateFormatted(java.util.Date date, java.lang.String pattern, java.util.Locale locale)
date
- representing a datepattern
- as date patternlocale
- as date localepublic static java.lang.String getDateFormattedLong(java.util.Date date, java.util.Locale locale)
date
- representing a datelocale
- as date localepublic static java.lang.String getDateFormattedLongNice(java.util.Date date, java.util.Locale locale)
date
- representing a datelocale
- as date localepublic static java.lang.String getDatesFormatted(java.util.Collection<java.util.Date> dates, java.lang.String pattern, java.util.Locale locale)
dates
- representing a collection datepattern
- as date patternlocale
- as date localepublic static java.lang.String getDateFormattedMMMM_YYYY(java.util.Date date, java.util.Locale locale)
date
- representing a datelocale
- as date localepublic static java.lang.String getDateFormattedDD_MMMM_YYYY(java.util.Date date, java.util.Locale locale)
date
- representing a datelocale
- as date localepublic static java.lang.String getDateFormattedDateTimeEnglish(java.util.Date date)
date
- date to formatpublic static java.util.Date parseDate(java.lang.String date, java.lang.String pattern, java.util.Locale locale)
date
- to parsepattern
- to setlocale
- to setpublic static java.util.Date parseDate(java.lang.String dateStr)
dateStr
- dateStr to parsepublic static java.util.Date parseDateDateTimeEnglish(java.lang.String dateStr)
dateStr
- dateStr to parsepublic static java.util.Date parseTimeHHMM(java.lang.String timeString, java.util.Locale locale)
timeString
- to parselocale
- representing a localpublic static java.util.Date parseTimeHHMMSS(java.lang.String timeString, java.util.Locale locale)
timeString
- to parselocale
- representing a localpublic static java.util.Date copyTimeToDate(java.util.Date date, java.util.Date time)
date
- representing datetime
- representing time to add to datepublic static java.util.Date addDate(java.util.Date date, int field, int value)
date
- representing a datefield
- field constant from Calendar
value
- value to addpublic static java.util.Date addSeconds(java.util.Date date, int seconds)
date
- representing dateseconds
- representing seconds to add to datepublic static java.lang.Integer getDateFieldValue(java.util.Date date, int field)
date
- representing a datefield
- field constant from Calendar
public static boolean compareYearAndMonth(java.util.Date date1, java.util.Date date2)
date1
- date to comparedate2
- date to comparepublic static boolean isSameDay(java.util.Date date1, java.util.Date date2)
date1
- date to comparedate2
- date to comparepublic static boolean isSameDay(java.util.Date date1, java.util.Date date2, boolean checkMidnight)
date1
- date to comparedate2
- date to comparecheckMidnight
- if set to true, check if the date to is midnightpublic static boolean isSameYear(java.util.Date date1, java.util.Date date2)
date1
- date to comparedate2
- date to comparepublic static boolean isSameMonth(java.util.Date date1, java.util.Date date2)
date1
- date to comparedate2
- date to comparepublic static java.util.Date getDate(long timeInMillis)
timeInMillis
- representing a longpublic static java.util.Date getDateSum(java.util.Date date, java.util.Date time)
date
- representing a datetime
- representing a datepublic static java.util.Date getDateSumCheckMidnight(java.util.Date date, java.util.Date time)
date
- representing a datetime
- representing a datepublic static java.util.Date getDateSumCheckMidnightView(java.util.Date date, java.util.Date time)
public static java.util.Date getTimeMidnightView(java.util.Date time)
public static java.util.Date getDate(int year, int month, int day, int hour, int minutes)
YEAR
, MONTH
, DAY_OF_MONTH
,
HOUR_OF_DAY
, and MINUTE
. The SECOND
are set to 0.year
- the value used to set the YEAR
calendar field.month
- the value used to set the MONTH
calendar field. Month value is 1-based. e.g., 1 for
January.day
- the value used to set the DAY_OF_MONTH
calendar field.hour
- the value used to set the HOUR_OF_DAY
calendar field.minutes
- the value used to set the MINUTE
calendar field.public static java.util.Date getDate(int year, int month, int day)
public static java.util.Date getTime(int hour, int minute, int second)
public static java.util.Date getTime(int hour, int minute)
public static java.util.Date getApplMaxDate()
public static java.util.Date getApplInfiniteDate()
public static java.util.Date getApplMinDate()
public static boolean isInGivenDates(java.util.List<java.util.Date> validDates, java.util.Date dataDate)
validDates
- representing datesdataDate
- representing a datepublic static boolean isDateInPeriod(java.util.Date dateFrom, java.util.Date dateTo, java.util.Date dateToCheck)
dateFrom
- start date of the validity rangedateTo
- end date of the validity rangedateToCheck
- check this datepublic static boolean areDatesOverlapping(java.util.Date dateFrom, java.util.Date dateTo, java.util.Date dateFromToCheck, java.util.Date dateToToCheck)
public static java.lang.String getTextFromBoolean(java.lang.Boolean value)
value
- as Booleanpublic static int getIntFromBoolean(java.lang.Boolean value)
value
- as Booleanpublic static boolean getBooleanFromText(java.lang.String value)
value
- as Stringpublic static boolean getBooleanFromInteger(java.lang.Integer value)
value
- as Integerpublic static boolean getBooleanFromInt(int value)
value
- as intpublic static java.lang.Long getLongWithFallback(java.lang.String value, long fallback)
value
- as Stringfallback
- as longpublic static java.lang.Integer getIntegerWithFallback(java.lang.String value, int fallback)
value
- as Stringfallback
- as intpublic static java.lang.Integer getInteger(java.lang.String value)
value
- as Stringpublic static java.lang.Double getDouble(java.lang.String value)
value
- as Stringpublic static double getDoubleOrZero(java.lang.Double value)
value
- as Doublepublic static int getIntOrZero(java.lang.Integer value)
value
- as Integerpublic static java.lang.String getPropertyWithFallback(java.util.Properties properties, java.lang.String propertyName, java.lang.String fallback)
properties
- as PropertiespropertyName
- as Stringfallback
- as Stringpublic static java.lang.String getStackTrace(java.lang.Throwable error)
error
- as Throwablepublic static int compareDates(java.util.Date date1, java.util.Date date2)
date1
- representing a datedate2
- representing a datepublic static int compareDateAndTimes(java.util.Date date1, java.util.Date date2)
date1
- representing a datedate2
- representing a datepublic static int compareTimes(java.util.Date date1, java.util.Date date2)
date1
- representing a datedate2
- representing a datepublic static java.lang.String lpad(java.lang.String input, char padding, int length)
input
- The input string.padding
- The char used for padding.length
- The length of the new string.public static java.lang.String rpad(java.lang.String input, char padding, int length)
input
- The input string.padding
- The char used for padding.length
- The length of the new string.public static boolean isGivenDayOfWeek(java.util.Date date, int dayOfWeek)
date
- representing a datedayOfWeek
- from Calendar
constantspublic static java.util.List<java.util.Date> getDaysInPeriod(java.util.Date startDate, java.util.Date endDate, java.util.List<java.lang.Integer> excludedDaysInWeek, java.util.List<java.lang.Integer> includedDaysInWeek)
startDate
- representing a dateendDate
- representing a dateexcludedDaysInWeek
- from Calendar
constants. Don't use includedDaysInWeek and excludedDaysInWeek at the same time.includedDaysInWeek
- from Calendar
constants. Don't use includedDaysInWeek and excludedDaysInWeek at the same time.public static java.math.BigDecimal convertDoubleToBigDecimal(double value)
value
- as Doublepublic static java.lang.Integer convertHoursToMinutes(java.lang.Double hours)
Double
hours value to Integer
minutes.hours
- as Doublepublic static java.lang.Integer convertHoursToSecondes(java.lang.Double hours)
Double
hours value to Integer
minutes.hours
- as Doublepublic static java.lang.Double convertMinutesToHours(java.lang.Integer minutes)
Integer
minutes value to Integer
hours.minutes
- as Integerpublic static boolean compareMinutes(java.lang.Integer minutes, java.lang.Integer minutes2)
public static java.lang.String formatBigDecimal(java.math.BigDecimal value, java.lang.Integer maxFractionDigits)
value
- as BigDecimalmaxFractionDigits
- as Integerpublic static java.lang.String formatBigDecimal(java.math.BigDecimal value, java.lang.Integer minFractionDigits, java.lang.Integer maxFractionDigits)
BigDecimal
value using LOCALE_DE_CH
locale.value
- as BigDecimalminFractionDigits
- as IntegermaxFractionDigits
- as Integerpublic static java.lang.String roundAndFormatDouble(java.lang.Double value)
public static java.lang.String roundAndFormatDouble(java.lang.Double value, int fractionDigits)
value
- as DoublefractionDigits
- as intpublic static java.lang.String formatDouble(java.lang.Double value, java.lang.Integer maxFractionDigits)
value
- as DoublemaxFractionDigits
- as Integerpublic static java.lang.String formatDouble(java.lang.Double value, java.lang.Integer minFractionDigits, java.lang.Integer maxFractionDigits)
BigDecimal
value using LOCALE_DE_CH
locale.value
- as DoubleminFractionDigits
- as IntegermaxFractionDigits
- as Integerpublic static java.lang.Double roundDouble(java.lang.Double value, int decimalPlaces)
value
- value can be nulldecimalPlaces
- number of decimal places. Value between 0 and 15.public static java.lang.Double roundAmount(java.lang.Double value, int decimalPlaces)
value
- value can be nulldecimalPlaces
- number of decimal places. Value between 0 and 15.public static java.lang.String formatLong(java.lang.Long value)
Long
value using LOCALE_DE_CH
locale.value
- as Longpublic static java.util.Date getTime(java.util.Date date)
date
- representing a datepublic static java.lang.Integer getTimeDiffInMinutes(java.util.Date from, java.util.Date to)
public static java.lang.Integer getMinutesFormattedFromTime(java.util.Date date)
date
- representing a datepublic static java.lang.Integer getNumberOfDaysBetweenDates(java.util.Date d1, java.util.Date d2)
d1
- as Dated2
- as Datepublic static java.lang.String truncateString(java.lang.String str, int maxLength)
str
- as StringmaxLength
- as intpublic static java.lang.String substring(java.lang.String str, int beginIndex, int endIndex)
str
- as StringbeginIndex
- as intendIndex
- as intpublic static java.lang.String trimString(java.lang.String value)
value
- as Stringpublic static final java.lang.String convertIds(java.util.List<java.lang.Integer> ids)
ids
- as Integer collectionpublic static final java.util.ArrayList<java.lang.String> convertToList(java.lang.String str)
str
- as Stringpublic static java.math.BigDecimal addBDToTotal(java.math.BigDecimal oldTotal, java.math.BigDecimal value)
public static java.lang.Double addDoubleToTotal(java.lang.Double oldTotal, java.lang.Double value)
public static java.lang.Double addRoundedDoubleToTotal(java.lang.Double oldTotal, java.lang.Double value, java.lang.Integer decimalPlaces)
public static java.lang.Integer addIntegerToTotal(java.lang.Integer oldTotal, java.lang.Integer value)
public static java.math.BigDecimal divideBD(java.math.BigDecimal value1, java.math.BigDecimal value2)
public static java.lang.Double divideDouble(java.lang.Double value1, java.lang.Double value2)
public static java.lang.Double divideInteger(java.lang.Integer value1, java.lang.Integer value2)
public static java.lang.String divideAndFormatBD(java.math.BigDecimal value1, java.math.BigDecimal value2)
public static java.lang.String divideAndFormatDouble(java.lang.Double value1, java.lang.Double value2)
public static java.lang.String divideAndFormatBDToPercent(java.math.BigDecimal value1, java.math.BigDecimal value2, boolean showPercentCharacter)
public static java.lang.Double divideBDToPercent(java.math.BigDecimal value1, java.math.BigDecimal value2)
public static java.lang.String divideAndFormatDoubleToPercent(java.lang.Double value1, java.lang.Double value2, boolean showPercentCharacter)
public static java.util.Date parseWeekYear(java.lang.String weekYear)
weekYear
- pattern: 'ww/YYYY'.public static java.lang.String formatWeekYear(java.util.Date weekYearDate)
weekYearDate
- as Datepublic static boolean isAfterOfEquals(java.util.Date first, java.util.Date second)
first
- as Datesecond
- as Datepublic static boolean isBeforeOrEquals(java.util.Date first, java.util.Date second)
first
- as Datesecond
- as Datepublic static int getLastWeekInMonth(java.util.Calendar lastDayOfMonth)
public static int getLastWeekInMonth(java.util.Date date)
public static boolean isWeekendDay(java.util.Date dateToCheck)
dateToCheck
- as Datepublic static boolean isMonday(java.util.Date dateToCheck)
dateToCheck
- as Datepublic static boolean isMonday(java.util.Calendar dateToCheck)
dateToCheck
- as Calendarpublic static boolean isFriday(java.util.Date dateToCheck)
dateToCheck
- as Datepublic static boolean isFriday(java.util.Calendar dateToCheck)
dateToCheck
- as Calendarpublic static boolean isSunday(java.util.Date dateToCheck)
dateToCheck
- as Datepublic static boolean isSunday(java.util.Calendar dateToCheck)
dateToCheck
- as Calendarpublic static boolean isSaturday(java.util.Date dateToCheck)
dateToCheck
- as Datepublic static boolean isSaturday(java.util.Calendar dateToCheck)
dateToCheck
- as Calendarpublic static boolean isThursday(java.util.Date dateToCheck)
dateToCheck
- as Datepublic static boolean isThursday(java.util.Calendar dateToCheck)
dateToCheck
- as Calendarpublic static java.util.Date getSameWeekDayLastYear(java.util.Date calendarDate)
public static java.lang.String getTimeFormatted(double value)
value
- as doublepublic static java.lang.String getTimeFormatted(java.lang.String value)
value
- as Stringpublic static java.lang.String getTimeFormattedFromMinutes(java.lang.Integer minutes, java.util.Locale locale)
minutes
- as Integerlocale
- as Localepublic static java.util.Date getDateWithoutSeconds(java.util.Date date)
date
- for this date the time should be set to 0 o'clockpublic static java.util.Date getDateWithoutTime(java.util.Date date)
public static java.util.Date getNextWorkingDate(java.util.Date date)
public static java.util.Date getPreviousWorkingDate(java.util.Date date)
public static java.util.Date getNextMonday(java.util.Date date)
public static java.lang.String formatDoubleToCurrency(java.lang.Double value)
public static java.lang.String formatDoubleToKm(java.lang.Double value)
public static java.lang.String reverse(java.lang.String source)
public static java.lang.Object getNestedValue(java.util.Map map, java.lang.String... keys)
Copyright © 2018 DS Data Systems UK Ltd.