Skip to content

Fluent method is not exact replica of setter method #1331

@fjtirado

Description

@fjtirado

If the generated setXX method is not trivial, his withXXX counterpart wont be aligned.
For example

@OneOfSetter(String.class)
    public void setExpressionErrorDetails(String expressionErrorDetails) {
        this.value = expressionErrorDetails;
        if (expressionErrorDetails_Pattern.matcher(expressionErrorDetails).matches()) {
            this.expressionErrorDetails = expressionErrorDetails;
        } else {
            if (literalErrorDetails_Pattern.matcher(expressionErrorDetails).matches()) {
                this.literalErrorDetails = expressionErrorDetails;
            } else {
                throw new ConstraintViolationException(String.format("%s does not match any pattern", expressionErrorDetails), null);
            }
        }
    }

is quite different from

public ErrorDetails withExpressionErrorDetails(String value) {
        expressionErrorDetails = value;
        this.value = value;
        return this;
    }

To fix that, withXXX should call setXXX

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions