当前位置: 首页>>代码示例>>Java>>正文


Java PropertyAccessException.getValue方法代码示例

本文整理汇总了Java中org.springframework.beans.PropertyAccessException.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyAccessException.getValue方法的具体用法?Java PropertyAccessException.getValue怎么用?Java PropertyAccessException.getValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.PropertyAccessException的用法示例。


在下文中一共展示了PropertyAccessException.getValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processPropertyAccessException

import org.springframework.beans.PropertyAccessException; //导入方法依赖的package包/类
/**
 * Adds an entry to the {@link org.kuali.rice.krad.util.GlobalVariables#getMessageMap()} for the given
 * binding processing error
 *
 * @param ex exception that was thrown
 * @param bindingResult binding result containing the results of the binding process
 */
@Override
public void processPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult) {
    // Create field error with the exceptions's code, e.g. "typeMismatch".
    super.processPropertyAccessException(ex, bindingResult);

    Object rejectedValue = ex.getValue();
    if (!(rejectedValue == null || rejectedValue.equals(""))) {
        if (ex.getCause() instanceof FormatException) {
            GlobalVariables.getMessageMap().putError(ex.getPropertyName(),
                    ((FormatException) ex.getCause()).getErrorKey(),
                    new String[] {rejectedValue.toString()});
        } else {
            GlobalVariables.getMessageMap().putError(ex.getPropertyName(), RiceKeyConstants.ERROR_CUSTOM,
                    new String[] {"Invalid format"});
        }
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:25,代码来源:UifBindingErrorProcessor.java

示例2: processPropertyAccessException

import org.springframework.beans.PropertyAccessException; //导入方法依赖的package包/类
@Override
public void processPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult) {
	// Create field error with the exceptions's code, e.g. "typeMismatch".
	String field = ex.getPropertyName();
	String[] codes = bindingResult.resolveMessageCodes(ex.getErrorCode(), field);
	Object[] arguments = getArgumentsForBindError(bindingResult.getObjectName(), field);
	Object rejectedValue = ex.getValue();
	if (rejectedValue != null && rejectedValue.getClass().isArray()) {
		rejectedValue = StringUtils.arrayToCommaDelimitedString(ObjectUtils.toObjectArray(rejectedValue));
	}
	bindingResult.addError(new FieldError(
			bindingResult.getObjectName(), field, rejectedValue, true,
			codes, arguments, ex.getLocalizedMessage()));
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:DefaultBindingErrorProcessor.java

示例3: processPropertyAccessException

import org.springframework.beans.PropertyAccessException; //导入方法依赖的package包/类
public void processPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult) {
	// Create field error with the exceptions's code, e.g. "typeMismatch".
	String field = ex.getPropertyName();
	String[] codes = bindingResult.resolveMessageCodes(ex.getErrorCode(), field);
	Object[] arguments = getArgumentsForBindError(bindingResult.getObjectName(), field);
	Object rejectedValue = ex.getValue();
	if (rejectedValue != null && rejectedValue.getClass().isArray()) {
		rejectedValue = StringUtils.arrayToCommaDelimitedString(ObjectUtils.toObjectArray(rejectedValue));
	}
	bindingResult.addError(new FieldError(
			bindingResult.getObjectName(), field, rejectedValue, true,
			codes, arguments, ex.getLocalizedMessage()));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:14,代码来源:DefaultBindingErrorProcessor.java

示例4: processPropertyAccessException

import org.springframework.beans.PropertyAccessException; //导入方法依赖的package包/类
public void processPropertyAccessException(PropertyAccessException ex, BindingResult bindingResult) {
	// Create field error with the exceptions's code, e.g. "typeMismatch".
	super.processPropertyAccessException(ex, bindingResult);
	Object rejectedValue = ex.getValue();
	if (!(rejectedValue == null || rejectedValue.equals(""))) {
		if (ex.getCause() instanceof FormatException) {
			GlobalVariables.getMessageMap().putError(ex.getPropertyName(), ((FormatException)ex.getCause()).getErrorKey(),
					new String[] {rejectedValue.toString()});
		}else{
			GlobalVariables.getMessageMap().putError(ex.getPropertyName(), RiceKeyConstants.ERROR_CUSTOM,
					new String[] {"Invalid format"});
		}
	}
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:15,代码来源:UifBindingErrorProcessor.java

示例5: processPropertyAccessException

import org.springframework.beans.PropertyAccessException; //导入方法依赖的package包/类
/** 
 * Add a ControlError instead FieldError to hold component that has failed.
 * @param control
 * @param ex
 * @param bindingResult
 */
public void processPropertyAccessException(Object control, PropertyAccessException ex, 
		BindingResult bindingResult ) {
	// Create field error with the exceptions's code, e.g. "typeMismatch".
	String field = ex.getPropertyName();
	String[] codes = bindingResult.resolveMessageCodes(ex.getErrorCode(), field);
	Object[] arguments = getArgumentsForBindError(bindingResult.getObjectName(), field);
	Object rejectedValue = ex.getValue();
	if (rejectedValue != null && rejectedValue.getClass().isArray()) {
		rejectedValue = StringUtils.arrayToCommaDelimitedString(ObjectUtils.toObjectArray(rejectedValue));
	}
	bindingResult.addError(new ControlError(control,
			bindingResult.getObjectName(), field, rejectedValue, true,
			codes, arguments, ex.getLocalizedMessage()));
}
 
开发者ID:chelu,项目名称:jdal,代码行数:21,代码来源:ControlBindingErrorProcessor.java


注:本文中的org.springframework.beans.PropertyAccessException.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。