Spring for Apache Hadoop

org.springframework.yarn.support.console
Class CommonUtils

java.lang.Object
  extended by org.springframework.yarn.support.console.CommonUtils

public abstract class CommonUtils
extends java.lang.Object

Contains common non-ui related helper methods for rendering text to the console.

Author:
Gunnar Hillert, Stephan Oudmaijer, Janne Valkealahti

Constructor Summary
CommonUtils()
           
 
Method Summary
static void closeReader(java.io.Reader reader)
           
static java.lang.String collectionToCommaDelimitedString(java.util.Collection<java.lang.String> list)
          Convert a List of Strings to a comma delimited String.
static boolean isValidEmail(java.lang.String emailAddress)
           
static java.lang.String maskPassword(java.lang.String password)
          Simple method to replace characters in a String with asterisks to mask the password.
static java.lang.String padRight(java.lang.String string, int size)
          Right-pad the provided String with empty spaces.
static java.lang.String padRight(java.lang.String inputString, int size, char paddingChar)
          Right-pad a String with a configurable padding character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonUtils

public CommonUtils()
Method Detail

padRight

public static java.lang.String padRight(java.lang.String inputString,
                                        int size,
                                        char paddingChar)
Right-pad a String with a configurable padding character.

Parameters:
inputString - The String to pad. A null String will be treated like an empty String.
size - Pad String by the number of characters.
paddingChar - The character to pad the String with.
Returns:
The padded String. If the provided String is null, an empty String is returned.

padRight

public static java.lang.String padRight(java.lang.String string,
                                        int size)
Right-pad the provided String with empty spaces.

Parameters:
string - The String to pad
size - Pad String by the number of characters.
Returns:
The padded String. If the provided String is null, an empty String is returned.

collectionToCommaDelimitedString

public static java.lang.String collectionToCommaDelimitedString(java.util.Collection<java.lang.String> list)
Convert a List of Strings to a comma delimited String.

Parameters:
list -
Returns:
Returns the List as a comma delimited String. Returns an empty String for a Null or empty list.

closeReader

public static void closeReader(java.io.Reader reader)
Parameters:
reader -

isValidEmail

public static boolean isValidEmail(java.lang.String emailAddress)
Parameters:
emailAddress - The email address to validate
Returns:
true if the provided email address is valid; false otherwise

maskPassword

public static java.lang.String maskPassword(java.lang.String password)
Simple method to replace characters in a String with asterisks to mask the password.

Parameters:
password - The password to mask

Spring for Apache Hadoop