public class InternalCommonsUtils extends Object
Modifier and Type | Field and Description |
---|---|
static AnnotationProvider |
NULL_ANNOTATION_PROVIDER |
Constructor and Description |
---|
InternalCommonsUtils() |
Modifier and Type | Method and Description |
---|---|
static <K,V> void |
addToMapList(Map<K,List<V>> map,
K key,
V value)
Adds a value to a specially organized map where the values are lists of objects.
|
static String |
asString(Method method)
Converts a method to a user presentable string consisting of the containing class name, the method name, and the
short form of the parameter list (the class name of each parameter type, shorn of the package name portion).
|
static String |
capitalize(String input)
Capitalizes a string, converting the first character to uppercase.
|
static boolean |
containsSymbols(String input)
Return true if the input string contains the marker for symbols that must be expanded.
|
static String |
defaultLabel(String id,
Messages messages,
String propertyExpression)
Looks for a label within the messages based on the id.
|
static String |
extractIdFromPropertyExpression(String expression)
Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages,
etc.).
|
static boolean |
isBlank(String input)
Returns true if the input is null, or is a zero length string (excluding leading/trailing whitespace).
|
static boolean |
isNonBlank(String input) |
static String |
join(List elements)
Joins together some number of elements to form a comma separated list.
|
static String |
join(List elements,
String separator)
Joins together some number of elements.
|
static String |
joinSorted(Collection elements)
Creates a sorted copy of the provided elements, then turns that into a comma separated list.
|
static String |
lastTerm(String input)
Searches the string for the final period ('.') character and returns everything after that.
|
static Location |
locationOf(Object location)
|
static String |
replace(String input,
Pattern pattern,
String replacement) |
static List<String> |
sortedKeys(Map map)
Extracts the string keys from a map and returns them in sorted order.
|
static String |
stripMemberName(String memberName)
Strips leading "_" and "$" and trailing "_" from the name.
|
static AnnotationProvider |
toAnnotationProvider(Class element) |
static AnnotationProvider |
toAnnotationProvider(Method element) |
static String |
toUserPresentable(String id)
Capitalizes the string, and inserts a space before each upper case character (or sequence of upper case
characters).
|
public static final AnnotationProvider NULL_ANNOTATION_PROVIDER
public InternalCommonsUtils()
public static <K,V> void addToMapList(Map<K,List<V>> map, K key, V value)
K
- the type of keyV
- the type of the listmap
- to store value intokey
- for which a value is addedvalue
- to addpublic static Location locationOf(Object location)
public static AnnotationProvider toAnnotationProvider(Method element)
public static String extractIdFromPropertyExpression(String expression)
expression
- a property expressionpublic static String defaultLabel(String id, Messages messages, String propertyExpression)
public static String toUserPresentable(String id)
public static AnnotationProvider toAnnotationProvider(Class element)
public static String asString(Method method)
method
- public static String stripMemberName(String memberName)
public static String join(List elements)
public static String join(List elements, String separator)
elements
- objects to be joined togetherseparator
- used between elements when joiningpublic static String joinSorted(Collection elements)
public static boolean isBlank(String input)
public static String capitalize(String input)
public static boolean isNonBlank(String input)
public static boolean containsSymbols(String input)
public static String lastTerm(String input)
public static List<String> sortedKeys(Map map)
map
- the map to extract keys from (may be null)5.6.3 - Copyright © 2003-2021 The Apache Software Foundation.