public String[] arrayAbbreviate(final Object[] target, final int maxSize) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = abbreviate(target[i], maxSize); } return result; }
public String[] arrayAppend(final Object[] target, final String suffix) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = append(target[i], suffix); } return result; }
/** * <p> * Convert the first letter into uppercase (title-case, in fact) for * all the elements in the target array. * </p> * * @param target the array of Strings to be capitalized. * If non-String objects, toString() will be called. * @return a String[] with the result of capitalizing * each element of the target. * * @since 1.1.2 * */ public String[] arrayCapitalize(final Object[] target) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = capitalize(target[i]); } return result; }
/** * <p> * Convert the first letter of each words of target * to uppercase (title-case, in fact) for * all the elements in the target array. * The default delimiter characters between the words are * the whitespace characters * (see Characters.IsWhiteSpace method in the Java documentation). * </p> * * @param target the array of Strings to be capitalized. * If non-String objects, toString() will be called. * * @return a String[] with the result of capitalizing * each element of the target. * * @since 1.1.2 * */ public String[] arrayCapitalizeWords(final Object[] target) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = capitalizeWords(target[i]); } return result; }
return new Strings(context.getLocale());
public Boolean[] arrayContains(final Object[] target, final String fragment) { if (target == null) { return null; } final Boolean[] result = new Boolean[target.length]; for (int i = 0; i < target.length; i++) { result[i] = contains(target[i], fragment); } return result; }
public Boolean[] arrayContainsIgnoreCase(final Object[] target, final String fragment) { if (target == null) { return null; } final Boolean[] result = new Boolean[target.length]; for (int i = 0; i < target.length; i++) { result[i] = containsIgnoreCase(target[i], fragment); } return result; }
public Boolean[] arrayEndsWith(final Object[] target, final String suffix) { if (target == null) { return null; } final Boolean[] result = new Boolean[target.length]; for (int i = 0; i < target.length; i++) { result[i] = endsWith(target[i], suffix); } return result; }
/** * <p> * Java-escapes all the elements in the target array. * </p> * * @param target the array of Strings to be escaped. * If non-String objects, toString() will be called. * * @return a String[] with the result of each * each element of the target. * * @since 2.0.11 * */ public String[] arrayEscapeJava(final Object[] target) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = escapeJava(target[i]); } return result; }
/** * <p> * Checks if each target element is empty and uses either target element, * or if the target element is empty uses {@code defaultValue}. * </p> * * @param target the array of values that to be checked if is null or empty * If non-String objects, toString() will be called. * @param defaultValue value to return if target is empty * If non-String objects, toString() will be called. * * @return a String[] with the result of {@link #defaultString(Object, Object)} * for each element of the target. * * @since 2.1.3 */ public String[] arrayDefaultString(final Object[] target, final Object defaultValue) { if (target == null) { return null; } final String[] result = new String[target.length]; for (int i = 0; i < target.length; i++) { result[i] = defaultString(target[i], defaultValue); } return result; }
result[i] = capitalizeWords(target[i], delimiters);
private static Map<String,Object> buildExpressionEvaluationUtilityObjects(final Locale locale) { Map<String,Object> objects = EXPRESSION_EVALUATION_UTILITY_OBJECTS_BY_LOCALE.get(locale); if (objects == null) { objects = new HashMap<String, Object>(30); if (locale != null) { objects.put(StandardExpressionObjectFactory.CALENDARS_EXPRESSION_OBJECT_NAME, new Calendars(locale)); objects.put(StandardExpressionObjectFactory.DATES_EXPRESSION_OBJECT_NAME, new Dates(locale)); objects.put(StandardExpressionObjectFactory.NUMBERS_EXPRESSION_OBJECT_NAME, new Numbers(locale)); objects.put(StandardExpressionObjectFactory.STRINGS_EXPRESSION_OBJECT_NAME, new Strings(locale)); } objects.put(StandardExpressionObjectFactory.BOOLS_EXPRESSION_OBJECT_NAME, new Bools()); objects.put(StandardExpressionObjectFactory.OBJECTS_EXPRESSION_OBJECT_NAME, new Objects()); objects.put(StandardExpressionObjectFactory.ARRAYS_EXPRESSION_OBJECT_NAME, new Arrays()); objects.put(StandardExpressionObjectFactory.LISTS_EXPRESSION_OBJECT_NAME, new Lists()); objects.put(StandardExpressionObjectFactory.SETS_EXPRESSION_OBJECT_NAME, new Sets()); objects.put(StandardExpressionObjectFactory.MAPS_EXPRESSION_OBJECT_NAME, new Maps()); objects.put(StandardExpressionObjectFactory.AGGREGATES_EXPRESSION_OBJECT_NAME, new Aggregates()); EXPRESSION_EVALUATION_UTILITY_OBJECTS_BY_LOCALE.put(locale, objects); } return new HashMap<String, Object>(objects); }
public Set<Boolean> setContains(final Set<?> target, final String fragment) { if (target == null) { return null; } final Set<Boolean> result = new LinkedHashSet<Boolean>(target.size() + 2); for (final Object element : target) { result.add(contains(element, fragment)); } return result; }
public List<Boolean> listContainsIgnoreCase(final List<?> target, final String fragment) { if (target == null) { return null; } final List<Boolean> result = new ArrayList<Boolean>(target.size() + 2); for (final Object element : target) { result.add(containsIgnoreCase(element, fragment)); } return result; }
public List<Boolean> listEndsWith(final List<?> target, final String suffix) { if (target == null) { return null; } final List<Boolean> result = new ArrayList<Boolean>(target.size() + 2); for (final Object element : target) { result.add(endsWith(element, suffix)); } return result; }
/** * <p> * Java-escapes all the elements in the target list. * </p> * * @param target the list of Strings to be escaped. * If non-String objects, toString() will be called. * * @return a List with the result of each * each element of the target. * * @since 2.0.11 * */ public List<String> listEscapeJava(final List<?> target) { if (target == null) { return null; } final List<String> result = new ArrayList<String>(target.size() + 2); for (final Object element : target) { result.add(escapeJava(element)); } return result; }
/** * <p> * Checks if each target element is empty and uses either target element, * or if the target element is empty uses {@code defaultValue}. * </p> * * @param target the list of values that to be checked if is null or empty * If non-String objects, toString() will be called. * @param defaultValue value to return if target is empty * If non-String objects, toString() will be called. * * @return a {@code List<String>} with the result of * {@link #defaultString(Object, Object)} for each element of the target. * * @since 2.1.3 */ public List<String> listDefaultString(final List<?> target, final Object defaultValue) { if (target == null) { return null; } final List<String> result = new ArrayList<String>(target.size() + 2); for (final Object element : target) { result.add(defaultString(element, defaultValue)); } return result; }
/** * <p> * Convert the first letter of each words of target * to uppercase (title-case, in fact) for * all the elements in the target list. * The default delimiter characters between the words are * the whitespace characters * (see Characters.IsWhiteSpace method in the Java documentation). * </p> * * @param target the list of Strings to be capitalized. * If non-String objects, toString() will be called. * * @return a List with the result of capitalizing * each element of the target. * * @since 1.1.2 * */ public List<String> listCapitalizeWords(final List<?> target) { if (target == null) { return null; } final List<String> result = new ArrayList<String>(target.size() + 2); for (final Object element : target) { result.add(capitalizeWords(element)); } return result; }
private static Map<String,Object> computeBaseObjectsByLocale(final Locale locale) { Map<String,Object> objects = BASE_OBJECTS_BY_LOCALE_CACHE.get(locale); if (objects == null) { objects = new HashMap<String, Object>(15); if (locale != null) { objects.put(CALENDARS_EVALUATION_VARIABLE_NAME, new Calendars(locale)); objects.put(DATES_EVALUATION_VARIABLE_NAME, new Dates(locale)); objects.put(NUMBERS_EVALUATION_VARIABLE_NAME, new Numbers(locale)); objects.put(STRINGS_EVALUATION_VARIABLE_NAME, new Strings(locale)); } objects.put(BOOLS_EVALUATION_VARIABLE_NAME, new Bools()); objects.put(OBJECTS_EVALUATION_VARIABLE_NAME, new Objects()); objects.put(ARRAYS_EVALUATION_VARIABLE_NAME, new Arrays()); objects.put(LISTS_EVALUATION_VARIABLE_NAME, new Lists()); objects.put(SETS_EVALUATION_VARIABLE_NAME, new Sets()); objects.put(MAPS_EVALUATION_VARIABLE_NAME, new Maps()); objects.put(AGGREGATES_EVALUATION_VARIABLE_NAME, new Aggregates()); BASE_OBJECTS_BY_LOCALE_CACHE.put(locale, objects); } return objects; }
public Set<String> setAppend(final Set<?> target, final String suffix) { if (target == null) { return null; } final Set<String> result = new LinkedHashSet<String>(target.size() + 2); for (final Object element : target) { result.add(append(element, suffix)); } return result; }