/** * <p>Tests if the list of method names used in the search for <code>Throwable</code> * objects include the given name.</p> * * @param methodName the methodName to search in the list. * @return if the list of method names used in the search for <code>Throwable</code> * objects include the given name. * @since 2.1 */ public static boolean isCauseMethodName(String methodName) { return ApacheCommonsLangUtil.indexOf(CAUSE_METHOD_NAMES, methodName) >= 0; }
public static String ucfirst(String str) { return ApacheCommonsLangUtil.capitalizeFully(str); }
private static boolean isDelimiter(char ch, char[] delimiters) { return ApacheCommonsLangUtil.isDelimiter(ch, delimiters); }
@Override public void log(LogLevel level, String message, Throwable throwable) { Level logLevel = level == LogLevel.INFO ? Level.INFO : Level.SEVERE; logger.log(logLevel, LogLevel.LOG_PREFIX + message); if (throwable != null) { for (String line : ACFPatterns.NEWLINE.split(ApacheCommonsExceptionUtil.getFullStackTrace(throwable))) { logger.log(logLevel, LogLevel.LOG_PREFIX + line); } } }
public static String join(String[] args, String sep) { return ApacheCommonsLangUtil.join(args, sep); } public static String join(String[] args, char sep) {
/** * <p>Returns the (zero based) index of the first <code>Throwable</code> * that matches the specified class or subclass in the exception chain. * Subclasses of the specified class do match - see * {@link #indexOfThrowable(Throwable, Class)} for the opposite.</p> * * <p>A <code>null</code> throwable returns <code>-1</code>. * A <code>null</code> type returns <code>-1</code>. * No match in the chain returns <code>-1</code>.</p> * * @param throwable the throwable to inspect, may be null * @param type the type to search for, subclasses match, null returns -1 * @return the index into the throwable chain, -1 if no match or null input * @since 2.1 */ public static int indexOfType(Throwable throwable, Class type) { return indexOf(throwable, type, 0, true); }
public static String capitalize(String str, char[] delimiters) { return ApacheCommonsLangUtil.capitalize(str, delimiters); } private static boolean isDelimiter(char ch, char[] delimiters) {
@Override public List<String> tabComplete(CommandIssuer issuer, String alias, String[] args) throws IllegalArgumentException { return command.tabComplete(issuer, alias, ApacheCommonsLangUtil.addAll(baseArgs, args)); }
public static boolean isNumber(String str) { return ApacheCommonsLangUtil.isNumeric(str); }
/** * <p>Check if a CharSequence starts with a specified prefix.</p> * * <p>{@code null}s are handled without exceptions. Two {@code null} * references are considered to be equal. The comparison is case sensitive.</p> * * <pre> * StringUtils.startsWith(null, null) = true * StringUtils.startsWith(null, "abc") = false * StringUtils.startsWith("abcdef", null) = false * StringUtils.startsWith("abcdef", "abc") = true * StringUtils.startsWith("ABCDEF", "abc") = false * </pre> * * @see java.lang.String#startsWith(String) * @param str the CharSequence to check, may be null * @param prefix the prefix to find, may be null * @return {@code true} if the CharSequence starts with the prefix, case sensitive, or * both {@code null} * @since 2.4 * @since 3.0 Changed signature from startsWith(String, String) to startsWith(CharSequence, CharSequence) */ public static boolean startsWith(final CharSequence str, final CharSequence prefix) { return startsWith(str, prefix, false); }
public static String join(Collection<String> args) { return ApacheCommonsLangUtil.join(args, " "); } public static String join(Collection<String> args, String sep) {
/** * <p>Returns the (zero based) index of the first <code>Throwable</code> * that matches the specified class (exactly) in the exception chain. * Subclasses of the specified class do not match - see * {@link #indexOfType(Throwable, Class)} for the opposite.</p> * * <p>A <code>null</code> throwable returns <code>-1</code>. * A <code>null</code> type returns <code>-1</code>. * No match in the chain returns <code>-1</code>.</p> * * @param throwable the throwable to inspect, may be null * @param clazz the class to search for, subclasses do not match, null returns -1 * @return the index into the throwable chain, -1 if no match or null input */ public static int indexOfThrowable(Throwable throwable, Class clazz) { return indexOf(throwable, clazz, 0, false); }
/** * <p>Finds the index of the given object in the array.</p> * * <p>This method returns {@link #INDEX_NOT_FOUND} (<code>-1</code>) for a <code>null</code> input array.</p> * * @param array the array to search through for the object, may be <code>null</code> * @param objectToFind the object to find, may be <code>null</code> * @return the index of the object within the array, * {@link #INDEX_NOT_FOUND} (<code>-1</code>) if not found or <code>null</code> array input */ public static int indexOf(Object[] array, Object objectToFind) { return indexOf(array, objectToFind, 0); }
/** * <p>Converts all the whitespace separated words in a String into capitalized words, * that is each word is made up of a titlecase character and then a series of * lowercase characters. </p> * * <p>Whitespace is defined by {@link Character#isWhitespace(char)}. * A <code>null</code> input String returns <code>null</code>. * Capitalization uses the Unicode title case, normally equivalent to * upper case.</p> * * <pre> * WordUtils.capitalizeFully(null) = null * WordUtils.capitalizeFully("") = "" * WordUtils.capitalizeFully("i am FINE") = "I Am Fine" * </pre> * * @param str the String to capitalize, may be null * @return capitalized String, <code>null</code> if null String input */ public static String capitalizeFully(final String str) { return capitalizeFully(str, null); }
/** * <p>Capitalizes all the whitespace separated words in a String. * Only the first character of each word is changed. To convert the * rest of each word to lowercase at the same time, * use {@link #capitalizeFully(String)}.</p> * * <p>Whitespace is defined by {@link Character#isWhitespace(char)}. * A <code>null</code> input String returns <code>null</code>. * Capitalization uses the Unicode title case, normally equivalent to * upper case.</p> * * <pre> * WordUtils.capitalize(null) = null * WordUtils.capitalize("") = "" * WordUtils.capitalize("i am FINE") = "I Am FINE" * </pre> * * @param str the String to capitalize, may be null * @return capitalized String, <code>null</code> if null String input * @see #capitalizeFully(String) */ public static String capitalize(final String str) { return capitalize(str, null); }
@Override public void execute(CommandIssuer issuer, String commandLabel, String[] args) { command.execute(issuer, commandLabel, ApacheCommonsLangUtil.addAll(baseArgs, args)); }
public static String join(Collection<String> args, String sep) { return ApacheCommonsLangUtil.join(args, sep); } public static String join(String[] args) {
/** * <p>Returns the (zero based) index of the first <code>Throwable</code> * that matches the specified type in the exception chain from * a specified index. * Subclasses of the specified class do match - see * {@link #indexOfThrowable(Throwable, Class)} for the opposite.</p> * * <p>A <code>null</code> throwable returns <code>-1</code>. * A <code>null</code> type returns <code>-1</code>. * No match in the chain returns <code>-1</code>. * A negative start index is treated as zero. * A start index greater than the number of throwables returns <code>-1</code>.</p> * * @param throwable the throwable to inspect, may be null * @param type the type to search for, subclasses match, null returns -1 * @param fromIndex the (zero based) index of the starting position, * negative treated as zero, larger than chain size returns -1 * @return the index into the throwable chain, -1 if no match or null input * @since 2.1 */ public static int indexOfType(Throwable throwable, Class type, int fromIndex) { return indexOf(throwable, type, fromIndex, true); }
public static String join(String[] args, int index, char sep) { return ApacheCommonsLangUtil.join(args, sep, index, args.length); }
/** * <p>Returns the (zero based) index of the first <code>Throwable</code> * that matches the specified type in the exception chain from * a specified index. * Subclasses of the specified class do not match - see * {@link #indexOfType(Throwable, Class, int)} for the opposite.</p> * * <p>A <code>null</code> throwable returns <code>-1</code>. * A <code>null</code> type returns <code>-1</code>. * No match in the chain returns <code>-1</code>. * A negative start index is treated as zero. * A start index greater than the number of throwables returns <code>-1</code>.</p> * * @param throwable the throwable to inspect, may be null * @param clazz the class to search for, subclasses do not match, null returns -1 * @param fromIndex the (zero based) index of the starting position, * negative treated as zero, larger than chain size returns -1 * @return the index into the throwable chain, -1 if no match or null input */ public static int indexOfThrowable(Throwable throwable, Class clazz, int fromIndex) { return indexOf(throwable, clazz, fromIndex, false); }