| java.lang.Object org.apache.tapestry.internal.TapestryInternalUtils
TapestryInternalUtils | public class TapestryInternalUtils (Code) | | Shared utility methods used by various implementation classes.
|
Method Summary | |
final public static void | close(Closeable stream) | public static String | defaultLabel(String id, Messages messages, String propertyExpression) Looks for a label within the messages based on the id. | public static int | defaultOrder(PropertyConduit conduit) | public 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.). | public static String | getLabelForEnum(Messages messages, String prefix, Enum value) | public static String | getLabelForEnum(Messages messages, Enum value) | public static boolean | isEqual(T left, T right) Determines if the two values are equal. | public static String | lastTerm(String input) Strips a dotted sequence (such as a property expression, or a qualified class name) down to
the last term of that expression, by locating the last period ('.') in the string. | public static Map<String, String> | mapFromKeysAndValues(String... keysAndValues) | public static List<String> | orderProperties(ClassPropertyAdapter classAdapter, ClassFactory classFactory, List<String> propertyNames) Sorts the property names into presentation order. | public static KeyValue | parseKeyValue(String input) Parses a key/value pair where the key and the value are seperated by an equals sign. | public static OptionModel | toOptionModel(String input) Converts a string to an
OptionModel . | public static OptionModel | toOptionModel(Map.Entry input) Converts a map entry to an
OptionModel . | public static OptionModel | toOptionModel(Object input) Converts an object to an
OptionModel . | public static List<OptionModel> | toOptionModels(String input) Parses a string input into a series of value=label pairs compatible with
TapestryInternalUtils.toOptionModel(String) . | public static List<OptionModel> | toOptionModels(Map<K, V> input) Processes a map input into a series of map entries compatible with
TapestryInternalUtils.toOptionModel(Map.Entry) . | public static List<OptionModel> | toOptionModels(List<E> input) Processes a list input into a series of objects compatible with
TapestryInternalUtils.toOptionModel(Object) . | public static SelectModel | toSelectModel(String input) Wraps the result of
TapestryInternalUtils.toOptionModels(String) as a
SelectModel (with no option
groups). | public static SelectModel | toSelectModel(Map<K, V> input) Wraps the result of
TapestryInternalUtils.toOptionModels(Map) as a
SelectModel (with no option
groups). | public static SelectModel | toSelectModel(List<E> input) Wraps the result of
TapestryInternalUtils.toOptionModels(List) as a
SelectModel (with no option
groups). | public 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 String | urlDecode(String input) | public static String | urlEncode(String input) |
defaultLabel | public static String defaultLabel(String id, Messages messages, String propertyExpression)(Code) | | 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.
|
extractIdFromPropertyExpression | public static String extractIdFromPropertyExpression(String expression)(Code) | | 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 - |
getLabelForEnum | public static String getLabelForEnum(Messages messages, String prefix, Enum value)(Code) | | Parameters: messages - the messages to search for the label Parameters: prefix - Parameters: value - to get a label for the label |
isEqual | public static boolean isEqual(T left, T right)(Code) | | Determines if the two values are equal. They are equal if they are the exact same value
(including if they are both null). Otherwise standard equals() comparison is used.
< Parameters: T - > Parameters: left - Parameters: right - |
lastTerm | public static String lastTerm(String input)(Code) | | Strips a dotted sequence (such as a property expression, or a qualified class name) down to
the last term of that expression, by locating the last period ('.') in the string.
|
orderProperties | public static List<String> orderProperties(ClassPropertyAdapter classAdapter, ClassFactory classFactory, List<String> propertyNames)(Code) | | Sorts the property names into presentation order. Filters out any properties that have an
explicit
Order , leaving the remainder. Estimates each propertie's position based on
the relative position of the property's getter. The code assumes that all methods are
readable (have a getter method).
Parameters: classAdapter - defines the bean that contains the properties Parameters: classFactory - used to access method line number information Parameters: propertyNames - the initial set of property names propertyNames filtered and sorted |
parseKeyValue | public static KeyValue parseKeyValue(String input)(Code) | | Parses a key/value pair where the key and the value are seperated by an equals sign. The key
and value are trimmed of leading and trailing whitespace, and returned as a
KeyValue .
Parameters: input - |
toOptionModel | public static OptionModel toOptionModel(String input)(Code) | | Converts a string to an
OptionModel . The string is of the form "value=label". If the
equals sign is omitted, then the same value is used for both value and label.
Parameters: input - |
toUserPresentable | public static String toUserPresentable(String id)(Code) | | 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".
|
|
|