Code example for Set

Methods: isEmpty

0
	 * 调用JSR303的validate方法, 验证失败时抛出ConstraintViolationException, 而不是返回constraintViolations. 
	 */ 
	public static void validateWithException(Validator validator, Object object, Class<?>... groups)
			throws ConstraintViolationException { 
		Set constraintViolations = validator.validate(object, groups);
		if (!constraintViolations.isEmpty()) {
			throw new ConstraintViolationException(constraintViolations);
		} 
	} 
 
	/** 
	 * 辅助方法, 转换ConstraintViolationException中的Set<ConstraintViolations>中为List<message>. 
	 */ 
	public static List<String> extractMessage(ConstraintViolationException e) {
		return extractMessage(e.getConstraintViolations());
	} 
 
	/** 
	 * 辅助方法, 转换Set<ConstraintViolation>为List<message> 
	 */