Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore FreeForm validation v2 #989

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -739,23 +739,14 @@ private void validateCascadedContainerElementsInContext(Object value, BaseBeanVa

private ValueContext<?, Object> buildNewLocalExecutionContext(ValueContext<?, ?> valueContext, Object value) {
ValueContext<?, Object> newValueContext;
if ( value != null ) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on the usage of this method null values could not be passed in here, as they go through a different logical branch. Reducing the number of different variations of ValueContext creations helps to fit in the property holders in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I merged this one.

newValueContext = ValueContext.getLocalExecutionContext(
validatorScopedContext.getParameterNameProvider(),
value,
beanMetaDataManager.getBeanMetaData( value.getClass() ),
valueContext.getPropertyPath()
);
newValueContext.setCurrentValidatedValue( value );
}
else {
newValueContext = ValueContext.getLocalExecutionContext(
validatorScopedContext.getParameterNameProvider(),
valueContext.getCurrentBeanType(),
valueContext.getCurrentBeanMetaData(),
valueContext.getPropertyPath()
);
}
Contracts.assertNotNull( value, "value cannot be null" );
newValueContext = ValueContext.getLocalExecutionContext(
validatorScopedContext.getParameterNameProvider(),
value,
beanMetaDataManager.getBeanMetaData( value.getClass() ),
valueContext.getPropertyPath()
);
newValueContext.setCurrentValidatedValue( value );

return newValueContext;
}
Expand Down