jsonschema-generator icon indicating copy to clipboard operation
jsonschema-generator copied to clipboard

feat: java validation support on supplier method

Open berlam opened this issue 3 years ago • 0 comments

You can now add annotations on the supplier method. This is useful for value objects, which consist of one value which resides in a base class.

public class PositiveInteger extends SimpleValueObject<Integer> {

    public PositiveInteger(@NonNull Integer value) {
        super(value);
        isTrue(value >= 0, "value needs to be greater or equal zero");
    }

    @Override
    @Min(0)
    public Integer get() {
        return super.get();
    }
}

berlam avatar Sep 08 '22 13:09 berlam