public class GeneralUtils extends Object
Modifier and Type | Field and Description |
---|---|
static DateTimeFormatter |
DEFAULT_FORMAT |
static DateTimeFormatter |
ISO_FORMAT |
static Object |
NULL |
static DateTimeFormatter |
SLUG_FORMAT |
static DateTimeFormatter |
SQL_FORMAT |
static ZoneId |
UTC |
Constructor and Description |
---|
GeneralUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
formatCurrency(Double amt) |
static String |
formatCurrency(Float amt) |
static String |
formatLocalDate(Object dt)
Deprecated.
|
static String |
formatLocalDate(Object dt,
String formatPattern)
Deprecated.
|
static String |
formatLocalDateFromJDate(Date date)
Deprecated.
|
static String |
formatLocalDateFromJDate(Date date,
String formatPattern)
Deprecated.
|
static String |
formatLocalDateFromLong(long epochMillis)
Deprecated.
|
static String |
formatLocalDateFromLong(Long epochMillis)
Deprecated.
|
static String |
formatLocalDateFromLong(long epochMillis,
String formatPattern)
Deprecated.
|
static String |
formatLocalDateFromLong(Long epochMillis,
String formatPattern)
Deprecated.
|
static String |
formatLocalDateFromZonedDate(ZonedDateTime date)
Deprecated.
|
static String |
formatLocalDateFromZonedDate(ZonedDateTime date,
String formatPattern)
Deprecated.
|
static String |
formatNow(String format)
Deprecated.
|
static String |
guessMimeType(String path) |
static Object |
htmlSafeJson(Object obj) |
static Object |
htmlSafeJson(Object obj,
String restrictionLevel)
Deprecated.
|
static boolean |
isValidEmailAddress(String email) |
static ZonedDateTime |
localNow()
Deprecated.
|
static String |
md5Hash(String val) |
static long |
mils()
Deprecated.
|
static ZonedDateTime |
milsToDateTime(long mils)
Deprecated.
|
static String |
randomToken(int length)
Generates a random string using the psuedo-random module, of the given length,
using URL safe base64 characters
|
static String |
randomTokenBase32(int length)
Psuedo-random string of the given length, in base32 characters
|
static String |
secureRandomToken(int length)
Generates a random string using the SecureRandom module, of the given length,
using URL safe base64 characters
|
static String |
slugify(String input)
Converts the string into a string containing only hyphens, lower-case letters, and numbers, removing all
other characters.
|
static String |
slugifyDate(Long epochMillis)
Deprecated.
|
static String |
slugifyDate(ZonedDateTime date)
Deprecated.
|
static String |
tokenForId(Long id,
int length)
Turn the given long id into a random base32 string token.
|
static String |
urlEncode(String s) |
static ZonedDateTime |
utcNow()
Deprecated.
|
public static final DateTimeFormatter DEFAULT_FORMAT
public static final DateTimeFormatter SLUG_FORMAT
public static final DateTimeFormatter ISO_FORMAT
public static final DateTimeFormatter SQL_FORMAT
public GeneralUtils()
public static String slugify(String input)
input
- public static String formatCurrency(Double amt)
public static String formatCurrency(Float amt)
public static String guessMimeType(String path)
public static boolean isValidEmailAddress(String email)
@Deprecated public static ZonedDateTime utcNow()
@Deprecated public static ZonedDateTime localNow()
@Deprecated public static long mils()
@Deprecated public static ZonedDateTime milsToDateTime(long mils)
@Deprecated public static String formatNow(String format)
@Deprecated public static String formatLocalDate(Object dt, String formatPattern)
@Deprecated public static String formatLocalDate(Object dt)
@Deprecated public static String formatLocalDateFromJDate(Date date)
@Deprecated public static String formatLocalDateFromJDate(Date date, String formatPattern)
@Deprecated public static String formatLocalDateFromLong(long epochMillis)
@Deprecated public static String formatLocalDateFromLong(long epochMillis, String formatPattern)
@Deprecated public static String formatLocalDateFromLong(Long epochMillis)
@Deprecated public static String formatLocalDateFromLong(Long epochMillis, String formatPattern)
@Deprecated public static String formatLocalDateFromZonedDate(ZonedDateTime date)
public static String tokenForId(Long id, int length)
id
- - a long id that will be convered to base32 and used as the first part of the stringlength
- - the number of random base32 characters to add to the end of the stringpublic static String randomTokenBase32(int length)
length
- public static String secureRandomToken(int length)
length
- public static String randomToken(int length)
length
- @Deprecated public static String formatLocalDateFromZonedDate(ZonedDateTime date, String formatPattern)
@Deprecated public static String slugifyDate(Long epochMillis)
@Deprecated public static String slugifyDate(ZonedDateTime date)
public static Object htmlSafeJson(Object obj)
@Deprecated public static Object htmlSafeJson(Object obj, String restrictionLevel)
obj
- restrictionLevel
- - Uses the JsonView annotation to determine which properties of the object
should be outputed. Possible values are: unrestricted/public/member/owner/internalCopyright © 2016. All rights reserved.