class PositiveDimensionValidator implements ConstraintValidator<PositiveDimensions, Dimension2D> {

    @Override
    public boolean isValid(Dimension2D value, ConstraintValidatorContext context) {
        if (value != null) {
            return value.getWidth() > 0 && value.getHeight() > 0;
        }
        return true;
    }

}