类org.springframework.beans.PropertyBatchUpdateException源码实例Demo

下面列出了怎么用org.springframework.beans.PropertyBatchUpdateException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: spring-analysis-note   文件: DataBinder.java
/**
 * Apply given property values to the target object.
 * <p>Default implementation applies all of the supplied property
 * values as bean property values. By default, unknown fields will
 * be ignored.
 * @param mpvs the property values to be bound (can be modified)
 * @see #getTarget
 * @see #getPropertyAccessor
 * @see #isIgnoreUnknownFields
 * @see #getBindingErrorProcessor
 * @see BindingErrorProcessor#processPropertyAccessException
 */
protected void applyPropertyValues(MutablePropertyValues mpvs) {
	try {
		// Bind request parameters onto target object.
		getPropertyAccessor().setPropertyValues(mpvs, isIgnoreUnknownFields(), isIgnoreInvalidFields());
	}
	catch (PropertyBatchUpdateException ex) {
		// Use bind error processor to create FieldErrors.
		for (PropertyAccessException pae : ex.getPropertyAccessExceptions()) {
			getBindingErrorProcessor().processPropertyAccessException(pae, getInternalBindingResult());
		}
	}
}
 
public void xtestTypeMismatch() {
	try {
		getBeanFactory().getBean("typeMismatch");
		fail("Shouldn't succeed with type mismatch");
	}
	catch (BeanCreationException wex) {
		assertEquals("typeMismatch", wex.getBeanName());
		assertTrue(wex.getCause() instanceof PropertyBatchUpdateException);
		PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause();
		// Further tests
		assertTrue("Has one error ", ex.getExceptionCount() == 1);
		assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null);
		assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x"));
	}
}
 
源代码3 项目: java-technology-stack   文件: DataBinder.java
/**
 * Apply given property values to the target object.
 * <p>Default implementation applies all of the supplied property
 * values as bean property values. By default, unknown fields will
 * be ignored.
 * @param mpvs the property values to be bound (can be modified)
 * @see #getTarget
 * @see #getPropertyAccessor
 * @see #isIgnoreUnknownFields
 * @see #getBindingErrorProcessor
 * @see BindingErrorProcessor#processPropertyAccessException
 */
protected void applyPropertyValues(MutablePropertyValues mpvs) {
	try {
		// Bind request parameters onto target object.
		getPropertyAccessor().setPropertyValues(mpvs, isIgnoreUnknownFields(), isIgnoreInvalidFields());
	}
	catch (PropertyBatchUpdateException ex) {
		// Use bind error processor to create FieldErrors.
		for (PropertyAccessException pae : ex.getPropertyAccessExceptions()) {
			getBindingErrorProcessor().processPropertyAccessException(pae, getInternalBindingResult());
		}
	}
}
 
public void xtestTypeMismatch() {
	try {
		getBeanFactory().getBean("typeMismatch");
		fail("Shouldn't succeed with type mismatch");
	}
	catch (BeanCreationException wex) {
		assertEquals("typeMismatch", wex.getBeanName());
		assertTrue(wex.getCause() instanceof PropertyBatchUpdateException);
		PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause();
		// Further tests
		assertTrue("Has one error ", ex.getExceptionCount() == 1);
		assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null);
		assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x"));
	}
}
 
源代码5 项目: lams   文件: DataBinder.java
/**
 * Apply given property values to the target object.
 * <p>Default implementation applies all of the supplied property
 * values as bean property values. By default, unknown fields will
 * be ignored.
 * @param mpvs the property values to be bound (can be modified)
 * @see #getTarget
 * @see #getPropertyAccessor
 * @see #isIgnoreUnknownFields
 * @see #getBindingErrorProcessor
 * @see BindingErrorProcessor#processPropertyAccessException
 */
protected void applyPropertyValues(MutablePropertyValues mpvs) {
	try {
		// Bind request parameters onto target object.
		getPropertyAccessor().setPropertyValues(mpvs, isIgnoreUnknownFields(), isIgnoreInvalidFields());
	}
	catch (PropertyBatchUpdateException ex) {
		// Use bind error processor to create FieldErrors.
		for (PropertyAccessException pae : ex.getPropertyAccessExceptions()) {
			getBindingErrorProcessor().processPropertyAccessException(pae, getInternalBindingResult());
		}
	}
}
 
源代码6 项目: spring4-understanding   文件: DataBinder.java
/**
 * Apply given property values to the target object.
 * <p>Default implementation applies all of the supplied property
 * values as bean property values. By default, unknown fields will
 * be ignored.
 * @param mpvs the property values to be bound (can be modified)
 * @see #getTarget
 * @see #getPropertyAccessor
 * @see #isIgnoreUnknownFields
 * @see #getBindingErrorProcessor
 * @see BindingErrorProcessor#processPropertyAccessException
 */
protected void applyPropertyValues(MutablePropertyValues mpvs) {
	try {
		// Bind request parameters onto target object.
		getPropertyAccessor().setPropertyValues(mpvs, isIgnoreUnknownFields(), isIgnoreInvalidFields());
	}
	catch (PropertyBatchUpdateException ex) {
		// Use bind error processor to create FieldErrors.
		for (PropertyAccessException pae : ex.getPropertyAccessExceptions()) {
			getBindingErrorProcessor().processPropertyAccessException(pae, getInternalBindingResult());
		}
	}
}
 
public void xtestTypeMismatch() {
	try {
		getBeanFactory().getBean("typeMismatch");
		fail("Shouldn't succeed with type mismatch");
	}
	catch (BeanCreationException wex) {
		assertEquals("typeMismatch", wex.getBeanName());
		assertTrue(wex.getCause() instanceof PropertyBatchUpdateException);
		PropertyBatchUpdateException ex = (PropertyBatchUpdateException) wex.getCause();
		// Further tests
		assertTrue("Has one error ", ex.getExceptionCount() == 1);
		assertTrue("Error is for field age", ex.getPropertyAccessException("age") != null);
		assertTrue("We have rejected age in exception", ex.getPropertyAccessException("age").getPropertyChangeEvent().getNewValue().equals("34x"));
	}
}
 
 同包方法