0

We have an endpoint with a lot of boolean on it, with default values. I wanted to encapsulate those into an object thanks to the @ParameterObject annotation.

However, I haven't found a way to set default values for it. My idea was to have something similar to what @PageableDault does.

Here the endpoint:

public List<Person> getPersons(@ParameterObject SearchCriteria profileSearchCriteria) {
  // beautiful code
}

And here the object (it uses Lombok but shouldn't have an impact I would say :)):

@Builder
@Data
@Jacksonized
public class ProfileSearchCriteria {

    @Builder.Default
    private boolean criteria1 = false;

    @Builder.Default
    private boolean criteria2 = false;

    @Builder.Default
    private boolean criteria3 = false;

Do you know how can I setup default values for the @ParameterObject annotation?

Ludovic Mouline
  • 163
  • 1
  • 6

0 Answers0