Class InternalCommonsUtils
- java.lang.Object
- 
- org.apache.tapestry5.commons.internal.util.InternalCommonsUtils
 
- 
 public class InternalCommonsUtils extends java.lang.Object Utility methods class for the Commons package.
- 
- 
Field SummaryFields Modifier and Type Field Description static AnnotationProviderNULL_ANNOTATION_PROVIDER
 - 
Constructor SummaryConstructors Constructor Description InternalCommonsUtils()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
 voidaddToMapList(java.util.Map<K,java.util.List<V>> map, K key, V value)Adds a value to a specially organized map where the values are lists of objects.static java.lang.StringasString(java.lang.reflect.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 java.lang.Stringcapitalize(java.lang.String input)Capitalizes a string, converting the first character to uppercase.static booleancontainsSymbols(java.lang.String input)Return true if the input string contains the marker for symbols that must be expanded.static java.lang.StringdefaultLabel(java.lang.String id, Messages messages, java.lang.String propertyExpression)Looks for a label within the messages based on the id.static java.lang.StringextractIdFromPropertyExpression(java.lang.String expression)Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages, etc.).static booleanisNonBlank(java.lang.String input)static java.lang.Stringjoin(java.util.List elements)Joins together some number of elements to form a comma separated list.static java.lang.Stringjoin(java.util.List elements, java.lang.String separator)Joins together some number of elements.static java.lang.StringjoinSorted(java.util.Collection elements)Creates a sorted copy of the provided elements, then turns that into a comma separated list.static java.lang.StringlastTerm(java.lang.String input)Searches the string for the final period ('.') character and returns everything after that.static LocationlocationOf(java.lang.Object location)static java.lang.Stringreplace(java.lang.String input, java.util.regex.Pattern pattern, java.lang.String replacement)static java.util.List<java.lang.String>sortedKeys(java.util.Map map)Extracts the string keys from a map and returns them in sorted order.static java.lang.StringstripMemberName(java.lang.String memberName)Strips leading "_" and "$" and trailing "_" from the name.static AnnotationProvidertoAnnotationProvider(java.lang.Class element)static AnnotationProvidertoAnnotationProvider(java.lang.reflect.Method element)static java.lang.StringtoUserPresentable(java.lang.String id)Capitalizes the string, and inserts a space before each upper case character (or sequence of upper case characters).
 
- 
- 
- 
Field Detail- 
NULL_ANNOTATION_PROVIDERpublic static final AnnotationProvider NULL_ANNOTATION_PROVIDER - Since:
- 5.3
 
 
- 
 - 
Constructor Detail- 
InternalCommonsUtilspublic InternalCommonsUtils() 
 
- 
 - 
Method Detail- 
addToMapListpublic static <K,V> void addToMapList(java.util.Map<K,java.util.List<V>> map, K key, V value) Adds a value to a specially organized map where the values are lists of objects. This somewhat simulates a map that allows multiple values for the same key.- Type Parameters:
- K- the type of key
- V- the type of the list
- Parameters:
- map- to store value into
- key- for which a value is added
- value- to add
 
 - 
locationOfpublic static Location locationOf(java.lang.Object location) 
 - 
toAnnotationProviderpublic static AnnotationProvider toAnnotationProvider(java.lang.reflect.Method element) 
 - 
extractIdFromPropertyExpressionpublic static java.lang.String extractIdFromPropertyExpression(java.lang.String expression) Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages, etc.). Strips out any punctuation characters, leaving just words characters (letters, number and the underscore).- Parameters:
- expression- a property expression
- Returns:
- the expression with punctuation removed
 
 - 
replacepublic static java.lang.String replace(java.lang.String input, java.util.regex.Pattern pattern, java.lang.String replacement) 
 - 
defaultLabelpublic static java.lang.String defaultLabel(java.lang.String id, Messages messages, java.lang.String propertyExpression) Looks for a label within the messages based on the id. If found, it is used, otherwise the name is converted to a user presentable form.
 - 
toUserPresentablepublic static java.lang.String toUserPresentable(java.lang.String id) Capitalizes the string, and inserts a space before each upper case character (or sequence of upper case characters). Thus "userId" becomes "User Id", etc. Also, converts underscore into space (and capitalizes the following word), thus "user_id" also becomes "User Id".
 - 
toAnnotationProviderpublic static AnnotationProvider toAnnotationProvider(java.lang.Class element) - Since:
- 5.3
 
 - 
asStringpublic static java.lang.String asString(java.lang.reflect.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).- Parameters:
- method-
- Returns:
- short string representation
 
 - 
stripMemberNamepublic static java.lang.String stripMemberName(java.lang.String memberName) Strips leading "_" and "$" and trailing "_" from the name.
 - 
joinpublic static java.lang.String join(java.util.List elements) Joins together some number of elements to form a comma separated list.
 - 
joinpublic static java.lang.String join(java.util.List elements, java.lang.String separator) Joins together some number of elements. If a value in the list is the empty string, it is replaced with the string "(blank)".- Parameters:
- elements- objects to be joined together
- separator- used between elements when joining
 
 - 
joinSortedpublic static java.lang.String joinSorted(java.util.Collection elements) Creates a sorted copy of the provided elements, then turns that into a comma separated list.- Returns:
- the elements converted to strings, sorted, joined with comma ... or "(none)" if the elements are null or empty
 
 - 
capitalizepublic static java.lang.String capitalize(java.lang.String input) Capitalizes a string, converting the first character to uppercase.
 - 
isNonBlankpublic static boolean isNonBlank(java.lang.String input) 
 - 
containsSymbolspublic static boolean containsSymbols(java.lang.String input) Return true if the input string contains the marker for symbols that must be expanded.
 - 
lastTermpublic static java.lang.String lastTerm(java.lang.String input) Searches the string for the final period ('.') character and returns everything after that. The input string is generally a fully qualified class name, though tapestry-core also uses this method for the occasional property expression (which is also dot separated). Returns the input string unchanged if it does not contain a period character.
 - 
sortedKeyspublic static java.util.List<java.lang.String> sortedKeys(java.util.Map map) Extracts the string keys from a map and returns them in sorted order. The keys are converted to strings.- Parameters:
- map- the map to extract keys from (may be null)
- Returns:
- the sorted keys, or the empty set if map is null
 
 
- 
 
-