src/org/ohmage/validator/SurveyResponseValidators.java
public static Function validateFunction(final String function) 
			throws ValidationException {
		
		if(StringUtils.isEmptyOrWhitespaceOnly(function)) {
			return null;
		}
		
		try {
			return Function.valueOf(function.toUpperCase());
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.SURVEY_INVALID_SURVEY_FUNCTION_ID, 
					"The survey response function ID is unknown: " + 
						function);
		}
	}
/**
	 * Validates that a function ID is a known function ID and returns it.
	 * 
	 * @param function The function ID as a string.
	 * 
	 * @return The decoded function ID as a Function or null if the string was
	 * 		   null or whitespace only.
	 * 
	 * @throws ValidationException Thrown if the function was not null, not
	 * 							   whitespace only, and not a valid function 
	 * 							   ID.
	 */
Validates that a function ID is a known function ID and returns it.

@param function The function ID as a string.

@return The decoded function ID as a Function or null if the string was
null or whitespace only.

@throws ValidationException Thrown if the function was not null, not
whitespace only, and not a valid function
ID.
Validates that a function ID is a known function ID and returns it . @param function The function ID as a string . @return The decoded function ID as a Function or null if the string was null or whitespace only . @throws ValidationException Thrown if the function was not null not whitespace only and not a valid function ID .
public static Function validateFunction(final String function) 
			throws ValidationException {
		if(StringUtils.isEmptyOrWhitespaceOnly(function)) {
			return null;
		}
		try {
			return Function.valueOf(function.toUpperCase());
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.SURVEY_INVALID_SURVEY_FUNCTION_ID, 
					"The survey response function ID is unknown: " + 
						function);
		}
	}
public static Function validateFunction ( final String function ) throws ValidationException { if ( StringUtils . isEmptyOrWhitespaceOnly ( function ) ) { return null ; } try { return Function . valueOf ( function . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . SURVEY_INVALID_SURVEY_FUNCTION_ID , "The survey response function ID is unknown: " + function ) ; } }
Validates that a function ID is a known function ID and returns it.
Validates that a function ID is a known function ID and returns it .