/** * 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). * * @param expression a property expression * @return the expression with punctuation removed */ public static String extractIdFromPropertyExpression(String expression) { return InternalCommonsUtils.extractIdFromPropertyExpression(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). * * @param expression a property expression * @return the expression with punctuation removed */ public static String extractIdFromPropertyExpression(String expression) { return InternalCommonsUtils.extractIdFromPropertyExpression(expression); }
/** * 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 defaultLabel(String id, Messages messages, String propertyExpression) { String key = id + "-label"; if (messages.contains(key)) return messages.get(key); return toUserPresentable(extractIdFromPropertyExpression(InternalCommonsUtils.lastTerm(propertyExpression))); }
public PropertyModelImpl(BeanModel model, String name, PropertyConduit conduit, Messages messages) { this.model = model; this.name = name; this.conduit = conduit; id = InternalCommonsUtils.extractIdFromPropertyExpression(name); label = InternalCommonsUtils.defaultLabel(id, messages, name); // TAP5-2305 if (conduit != null) { Sortable sortableAnnotation = conduit.getAnnotation(Sortable.class); if (sortableAnnotation != null) { sortable = sortableAnnotation.value(); } else { // Primitive types need to be converted to wrapper types before checking to see // if they are sortable. Class wrapperType = PlasticUtils.toWrapperType(getPropertyType()); sortable = Comparable.class.isAssignableFrom(wrapperType); } } }