Save This Page
Home » tapestry-src-5.0.19 » org.apache.tapestry5.internal » [javadoc | source]
org.apache.tapestry5.internal
public class: TapestryInternalUtils [javadoc | source]
java.lang.Object
   org.apache.tapestry5.internal.TapestryInternalUtils
Shared utility methods used by various implementation classes.
Method from org.apache.tapestry5.internal.TapestryInternalUtils Summary:
defaultLabel,   extractIdFromPropertyExpression,   getLabelForEnum,   getLabelForEnum,   isEqual,   lastTerm,   mapFromKeysAndValues,   parseKeyValue,   splitPath,   toClassAttributeValue,   toOptionModel,   toOptionModel,   toOptionModel,   toOptionModels,   toOptionModels,   toOptionModels,   toSelectModel,   toSelectModel,   toSelectModel,   toUserPresentable
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tapestry5.internal.TapestryInternalUtils Detail:
 public static String defaultLabel(String id,
    Messages messages,
    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.
 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.). Strips out any punctuation characters, leaving just words characters (letters, number and the underscore).
 public static String getLabelForEnum(Messages messages,
    Enum value) 
 public static String getLabelForEnum(Messages messages,
    String prefix,
    Enum value) 
    Converts an enum to a label string, allowing for overrides from a message catalog.

    • As key prefix.name if present. Ex: "ElementType.LOCAL_VARIABLE"
    • As key name if present, i.e., "LOCAL_VARIABLE".
    • As a user-presentable version of the name, i.e., "Local Variable".
 public static boolean isEqual(T left,
    T right) 
    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.
 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 KeyValue parseKeyValue(String input) 
    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 .
 public static String[] splitPath(String path) 
    Splits a path at each slash.
 public static String toClassAttributeValue(List<String> classes) 
    Converts an list of strings into a space-separated string combining them all, suitable for use as an HTML class attribute value.
 public static OptionModel toOptionModel(String input) 
    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.
 public static OptionModel toOptionModel(Entry input) 
 public static OptionModel toOptionModel(Object input) 
 public static List<OptionModel> toOptionModels(String input) 
    Parses a string input into a series of value=label pairs compatible with #toOptionModel(String) . Splits on commas. Ignores whitespace around commas.
 public static List<OptionModel> toOptionModels(Map<K, V> input) 
 public static List<OptionModel> toOptionModels(List<E> input) 
 public static SelectModel toSelectModel(String input) 
 public static SelectModel toSelectModel(Map<K, V> input) 
 public static SelectModel toSelectModel(List<E> input) 
 public static String toUserPresentable(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".