本文整理汇总了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"});
}
}
}
示例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()));
}
示例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()));
}
示例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"});
}
}
}
示例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()));
}