org.springframework.beans.PropertyBatchUpdateException Java Examples

The following examples show how to use org.springframework.beans.PropertyBatchUpdateException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataBinder.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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());
		}
	}
}
 
Example #2
Source File: AbstractBeanFactoryTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
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"));
	}
}
 
Example #3
Source File: DataBinder.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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());
		}
	}
}
 
Example #4
Source File: AbstractBeanFactoryTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
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"));
	}
}
 
Example #5
Source File: DataBinder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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());
		}
	}
}
 
Example #6
Source File: DataBinder.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
		}
	}
}
 
Example #7
Source File: AbstractBeanFactoryTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
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"));
	}
}