Skip to content

Commit

Permalink
Fix for compile error seen for Eclipse (issue 2390) (#2395) (#2396)
Browse files Browse the repository at this point in the history
* Fix for compile error seen for Eclipse (issue 2390) (#2395)
---------

Co-authored-by: greshje <[email protected]>
  • Loading branch information
chrisknoll and greshje authored Nov 4, 2024
1 parent b9feca7 commit faa0f57
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,34 @@ public final AbstractForEachValidatorBuilder<T, V> groups(ValidatorGroupBuilder<
}

protected List<ValidatorGroup<T, ?>> initGroups() {
return initAndBuildList(this.validatorGroupBuilders);
return initAndBuildGroupList(this.validatorGroupBuilders);
}

// Note: exact same functionality as initAndBuildList, just needed a different call signature.
// This method was added to enable development using Eclipse
private List<ValidatorGroup<T, ?>> initAndBuildGroupList(List<ValidatorGroupBuilder<T, ?>> builders) {

builders.forEach(builder -> {
if (Objects.isNull(builder.getBasePath())) {
builder.basePath(createChildPath());
}
if (Objects.isNull(builder.getErrorMessage())) {
builder.errorMessage(this.errorMessage);
}
if (Objects.isNull(builder.getSeverity())) {
builder.severity(this.severity);
}
if (Objects.isNull(builder.getAttrName())) {
builder.attrName(this.attrName);
}
});
return builders.stream()
.map(ValidatorBaseBuilder::build)
.collect(Collectors.toList());


}

protected List<Validator<T>> initValidators() {
return initAndBuildList(this.validatorBuilders);
}
Expand All @@ -70,4 +95,4 @@ private <U> List<U> initAndBuildList(List<? extends ValidatorBaseBuilder<T, U, ?


}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,34 @@ protected Path createChildPath() {

public ValidatorGroup<T, V> build() {

List<ValidatorGroup<V, ?>> groups = initAndBuildList(this.validatorGroupBuilders);
List<ValidatorGroup<V, ?>> groups = initAndBuildGroupList(this.validatorGroupBuilders);
List<Validator<V>> validators = initAndBuildList(this.validatorBuilders);

return new ValidatorGroup<>(validators, groups, valueGetter, conditionGetter);
}

// Note: exact same functionality as initAndBuildList, just needed a different call signature.
// This method was added to enable development using Eclipse
private List<ValidatorGroup<V, ?>> initAndBuildGroupList(List<ValidatorGroupBuilder<V, ?>> builders) {

builders.forEach(builder -> {
if (Objects.nonNull(this.errorMessage)) {
builder.errorMessage(this.errorMessage);
}
if (Objects.isNull(builder.getBasePath())) {
builder.basePath(createChildPath());
}
if (Objects.isNull(builder.severity)) {
builder.severity(this.severity);
}
});
return builders.stream()
.map(ValidatorBaseBuilder::build)
.collect(Collectors.toList());


}

private <U> List<U> initAndBuildList(List<? extends ValidatorBaseBuilder<V, U, ?>> builders) {

builders.forEach(builder -> {
Expand All @@ -89,4 +111,4 @@ private <U> List<U> initAndBuildList(List<? extends ValidatorBaseBuilder<V, U, ?

}

}
}

0 comments on commit faa0f57

Please sign in to comment.