public class BaseUtils extends Object
Modifier and Type | Class and Description |
---|---|
private static class |
BaseUtils.BeanComparator<T,U extends Comparable<? super U>> |
static class |
BaseUtils.CacheMissLogger |
static class |
BaseUtils.Clock |
static class |
BaseUtils.DuplicateChecker |
static class |
BaseUtils.Quadruple<A,B,C,D> |
Modifier and Type | Field and Description |
---|---|
static Pattern |
ACCEPTABLE_RELATIONSHIP |
static Pattern |
ACCEPTABLE_RELATIONSHIP_CLEANER |
static Pattern |
ACCEPTABLE_REQ_KEY
Some regexes
|
static com.google.gson.Gson |
GSON |
static Pattern |
ILLEGAL_CHARACTERS_IN_STRING_FOR_SEARCH |
static Pattern |
ISSUE_REGEX |
static String |
JSON_UTF8 |
private static org.apache.log4j.Logger |
log |
static Pattern |
NUMERABLE_KEY |
static Pattern |
PRETTY_URL_PATTERN |
static Pattern |
SEARCH_REQ_KEY_IN_TEXT |
static SimpleDateFormat |
SIMPLE_DATE_FORMAT_HOURLESS |
static SimpleDateFormat |
SIMPLE_DATE_FORMAT_HUMAN
Some date formats
|
static Pattern |
SIMPLE_PROPERTY |
static boolean |
USE_EXTENDED_REQKEYS |
Constructor and Description |
---|
BaseUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
between(Integer min,
int number,
Integer max) |
static <T,U extends Comparable<U>> |
buildBeanComparator(com.google.common.base.Function<? super T,U>... keyExtractors) |
static String |
cleanseRelationship(String userInput,
String defaultValue)
Cleanse a 'relationship', so it can be used for RYGlobalId.
|
static void |
closeQuietly(Closeable reader) |
static String |
coalesce(String value,
String... any) |
static <T2> int |
compare(Comparable<T2> o1,
T2 o2)
Return 1, 0 or -1 if o1 is superior, equal or inferior to o2, using o1.compareTo(o2)
Null is considered as inferior.
|
static <T extends Comparable<T>> |
compare(T a,
T b) |
static <T,U extends Comparable<U>> |
compare(T a,
T b,
Function<T,U> extractor) |
static String |
decodeBase64(String utf8String)
Decode a string which is encoded in UTF8 in Base64, into a simple string
|
static String |
decodeMacroParam(String key)
Requirement keys are encoded in the macro using encodeURIComponent().
|
static <T> void |
deduplicate(List<T> withDuplicates,
Comparator<? super T> comparator) |
static String |
encodeMacroParam(String key) |
static String |
encodeMacroParameterForXmlBlueprints(String serialized)
Encodes macro paramters for XHTML encoding.
|
static boolean |
equal(Object a,
Object b)
Convenience method, because Objects.equals() can't be statically imported
|
static String |
extractRelationshipFromConfig(String property) |
static String |
extractTextFromHtmlExcerpt(String htmlExcerpt)
Extracts text from HTML.
|
static String |
firstNonBlank(Object... values)
Returns the first non-blank value, or the last value if it is null or empty string
|
static <T> T |
firstNonNull(T... values)
Same as Objects.firstNonNull(), but doesn't throw an NPE if all values are null
|
static <T> T |
firstOf(Iterable<T> t) |
static <T> T |
firstOf(T... t) |
(package private) static Pattern |
getPrettyUrlPattern() |
(package private) static Pattern |
getRequirementKeyPattern()
Gets the Regex to check valid requirement keys.
|
static Integer |
getSystemPropertyInteger(String property,
Integer defaultValue) |
static <E,T> Map<E,List<T>> |
groupBy(List<T> list,
Function<T,E> keyExtractor) |
static Integer |
intOf(Object integer) |
static <T> Condition<T> |
is(T t) |
static boolean |
isDevMode()
Tells whether we are in dev mode.
|
static boolean |
isDevOrStagingMode()
Tells whether we are on dev or staging mode.
|
static boolean |
isEmpty(Iterable<?> iterable) |
static boolean |
isSpinnerSupported() |
(package private) static boolean |
isSpinnerSupported(String confluenceVersion)
Returns true if AUI supports the web-component spinners ( |
static boolean |
isTrue() |
(package private) static boolean |
isUseExtendedMode() |
static boolean |
isValidRequirementKey(String key) |
static <T> T |
lastOf(T... t) |
static <T> List<T> |
listOf(T... items) |
static Long |
longOf(String longValue) |
static <T,U> Map<T,U> |
mapOf(Object... values)
Like ImmutableMap.of(), but accepts nulls, unlimited parameters and mutable.
|
static List<String> |
parseExpand(String expand)
Parses the "expand" query parameter passed in the URL
|
static javax.ws.rs.core.UriBuilder |
parseUri(String url)
Deprecated.
Use
UrlBuilder.parse(String) instead |
static String |
replaceUndefined(String argument)
Return null if the argument is null, blank, "null" or "undefined",
otherwise return the argument.
|
static String |
trimHtml(String html) |
static String |
trimToNull(String value) |
static String |
urlDecode(String escapedQuery) |
static String |
urlEncode(String param) |
static String |
urlParameterEncode(String param) |
static boolean |
valueOfBooleanWithTrueByDefault(Object value) |
private static final org.apache.log4j.Logger log
public static final com.google.gson.Gson GSON
public static final String JSON_UTF8
public static final SimpleDateFormat SIMPLE_DATE_FORMAT_HUMAN
public static final SimpleDateFormat SIMPLE_DATE_FORMAT_HOURLESS
public static final boolean USE_EXTENDED_REQKEYS
public static final Pattern ACCEPTABLE_REQ_KEY
public static final Pattern NUMERABLE_KEY
public static final Pattern ILLEGAL_CHARACTERS_IN_STRING_FOR_SEARCH
public static final Pattern SEARCH_REQ_KEY_IN_TEXT
public static final Pattern SIMPLE_PROPERTY
public static final Pattern ISSUE_REGEX
public static final Pattern PRETTY_URL_PATTERN
public static final Pattern ACCEPTABLE_RELATIONSHIP
public static final Pattern ACCEPTABLE_RELATIONSHIP_CLEANER
public static String cleanseRelationship(String userInput, String defaultValue)
public static <T> T lastOf(T... t)
public static <T> T firstOf(T... t)
public static <T> T firstOf(Iterable<T> t)
public static <T> List<T> listOf(T... items)
public static String firstNonBlank(Object... values)
public static boolean isValidRequirementKey(String key)
public static javax.ws.rs.core.UriBuilder parseUri(String url)
UrlBuilder.parse(String)
insteadpublic static <T> T firstNonNull(T... values)
public static boolean equal(Object a, Object b)
public static boolean valueOfBooleanWithTrueByDefault(Object value)
@Nonnull public static List<String> parseExpand(String expand)
expand
- the value of the query parameterpublic static boolean isSpinnerSupported()
static boolean isSpinnerSupported(String confluenceVersion)
public static <T,U extends Comparable<U>> Comparator<T> buildBeanComparator(com.google.common.base.Function<? super T,U>... keyExtractors)
public static void closeQuietly(Closeable reader)
public static boolean isEmpty(Iterable<?> iterable)
public static <T2> int compare(Comparable<T2> o1, T2 o2)
public static String replaceUndefined(String argument)
public static <T> void deduplicate(List<T> withDuplicates, Comparator<? super T> comparator)
public static String encodeMacroParameterForXmlBlueprints(String serialized)
public static String decodeMacroParam(String key)
public static <T> Condition<T> is(T t)
public static String extractTextFromHtmlExcerpt(String htmlExcerpt)
public static boolean isTrue()
public static <T,U> Map<T,U> mapOf(Object... values)
public static <T extends Comparable<T>> int compare(T a, T b)
public static <T,U extends Comparable<U>> int compare(T a, T b, Function<T,U> extractor)
public static boolean isDevMode()
public static boolean isDevOrStagingMode()
public static Integer getSystemPropertyInteger(String property, Integer defaultValue)
static boolean isUseExtendedMode()
static Pattern getRequirementKeyPattern()
static Pattern getPrettyUrlPattern()
Copyright © 2021 Play SQL. All rights reserved.