Skip to content

Commit

Permalink
feat(policy-api):[#639] fix some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmf committed Jul 3, 2024
1 parent 1af6633 commit 52d04b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public class SearchParameterParser {
CommonConstants.PROPERTY_CREATED_ON);

public static final String CRITERIA_INNER_SEPARATOR = ",";
public static final int NUM_PARTS_OF_FILTERS = 3;

final List<SearchCriteria<?>> searchCriteria;
private final List<SearchCriteria<?>> searchCriteria;

public SearchParameterParser(final List<String> searchParameters) {
searchCriteria = parseSearchParameters(searchParameters);
Expand All @@ -54,7 +55,7 @@ private List<SearchCriteria<?>> parseSearchParameters(final List<String> searchP
final String searchParameter = searchParameterList.get(i);
final String[] splittedSearchParam = StringUtils.split(searchParameter, CRITERIA_INNER_SEPARATOR);

if (splittedSearchParam.length < 3) {
if (splittedSearchParam.length < NUM_PARTS_OF_FILTERS) {
throw new IllegalArgumentException(("Illegal search parameter at index %s. "
+ "Format should be <propertyName>,<operation>,<value>.").formatted(i));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ private PageImpl<PolicyWithBpn> applyPaging(final Pageable pageable, final List<
/**
* Builder for {@link Comparator} for sorting a list of {@link PolicyWithBpn} objects.
*/
static class PolicyComparatorBuilder {
private static class PolicyComparatorBuilder {
// TODO (mfischer): #639: maybe extract to separate class

private final Pageable pageable;

PolicyComparatorBuilder(final Pageable pageable) {
/* package */ PolicyComparatorBuilder(final Pageable pageable) {
this.pageable = pageable;
}

public Comparator<PolicyWithBpn> build() {
/* package */ Comparator<PolicyWithBpn> build() {

Comparator<PolicyWithBpn> comparator = null;

Expand Down Expand Up @@ -163,15 +164,16 @@ public Sort.Direction getSortDirection(final Pageable pageable, final String fie
/**
* Builder for {@link Predicate} for filtering a list of {@link PolicyWithBpn} objects.
*/
static class PolicyFilterBuilder {
private static class PolicyFilterBuilder {
// TODO (mfischer): #639: maybe extract to separate class

private final List<SearchCriteria<?>> searchCriteriaList;

PolicyFilterBuilder(final List<SearchCriteria<?>> searchCriteriaList) {
/* package */ PolicyFilterBuilder(final List<SearchCriteria<?>> searchCriteriaList) {
this.searchCriteriaList = searchCriteriaList;
}

private Predicate<PolicyWithBpn> build() {
/* package */ Predicate<PolicyWithBpn> build() {
Predicate<PolicyWithBpn> policyFilter = policy -> true;

for (final SearchCriteria<?> searchCriteria : searchCriteriaList) {
Expand Down

0 comments on commit 52d04b1

Please sign in to comment.