src/org/ohmage/validator/ClassValidators.java
public static Clazz.Role validateClassRole(final String role) 
			throws ValidationException {
		
		LOGGER.info("Validating a class role.");
		
		if(StringUtils.isEmptyOrWhitespaceOnly(role)) {
			return null;
		}
		
		try {
			return Clazz.Role.getValue(role.trim());
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.CLASS_INVALID_ROLE, 
					"Unkown class role: " + role, 
					e);
		}
	}
/**
	 * Validates that the given class role exists. If it is null or whitespace
	 * only, null is returned. If it is not a valid role, a ValidationException
	 * is thrown. If it is a valid role, it is returned.
	 * 
	 * @param role The class role to validate.
	 * 
	 * @return Returns null if the class role is null or whitespace only; 
	 * 		   otherwise, the class role is returned.
	 * 
	 * @throws ValidationException Thrown if the class role is not a valid class
	 * 							  role.
	 */
Validates that the given class role exists. If it is null or whitespace
only, null is returned. If it is not a valid role, a ValidationException
is thrown. If it is a valid role, it is returned.

@param role The class role to validate.

@return Returns null if the class role is null or whitespace only;
otherwise, the class role is returned.

@throws ValidationException Thrown if the class role is not a valid class
role.
Validates that the given class role exists . If it is null or whitespace only null is returned . If it is not a valid role a ValidationException is thrown . If it is a valid role it is returned . @param role The class role to validate . @return Returns null if the class role is null or whitespace only ; otherwise the class role is returned . @throws ValidationException Thrown if the class role is not a valid class role .
public static Clazz.Role validateClassRole(final String role) 
			throws ValidationException {
		LOGGER.info("Validating a class role.");
		if(StringUtils.isEmptyOrWhitespaceOnly(role)) {
			return null;
		}
		try {
			return Clazz.Role.getValue(role.trim());
		}
		catch(IllegalArgumentException e) {
			throw new ValidationException(
					ErrorCode.CLASS_INVALID_ROLE, 
					"Unkown class role: " + role, 
					e);
		}
	}
public static Clazz . Role validateClassRole ( final String role ) throws ValidationException { LOGGER . info ( "Validating a class role." ) ; if ( StringUtils . isEmptyOrWhitespaceOnly ( role ) ) { return null ; } try { return Clazz . Role . getValue ( role . trim ( ) ) ; } catch ( IllegalArgumentException e ) { throw new ValidationException ( ErrorCode . CLASS_INVALID_ROLE , "Unkown class role: " + role , e ) ; } }
Validates that the given class role exists.
Validates that the given class role exists .