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

项目: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());
        }
    }
}
项目: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());
        }
    }
}
项目:spring4-understanding    文件:AbstractBeanFactoryTests.java   
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"));
    }
}
项目:my-spring-cache-redis    文件: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());
        }
    }
}
项目:put-it-to-rest    文件:AccessTokensMissingTest.java   
@Test
public void shouldFailDueToMissingAccessTokenUrl() {
    exception.expectCause(instanceOf(PropertyBatchUpdateException.class));
    exception.expectCause(hasFeature("exception", PropertyBatchUpdateException::getPropertyAccessExceptions,
            hasItemInArray(hasFeature("cause", Throwables::getRootCause,
                    hasFeature("message", Throwable::getMessage,
                            compose(containsString("rest.oauth.access-token-url")).and(
                                    containsString("ACCESS_TOKEN_URL")))))));

    new SpringApplicationBuilder(TestConfiguration.class)
            .profiles("default")
            .build()
            .run();
}
项目:spring    文件: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());
        }
    }
}
项目:class-guard    文件: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());
        }
    }
}
项目:class-guard    文件:AbstractBeanFactoryTests.java   
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"));
    }
}