Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addModifiers method in FieldSpec and TypeSpec accepting Iterable #901

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

homedirectory
Copy link

Currently FieldSpec and TypeSpec both have addModifiers method that accepts a variable number of arguments of type Modifier:

public Builder addModifiers(Modifier... modifiers) {
    Collections.addAll(this.modifiers, modifiers);
    return this;
}

In contrast, MethodSpec has an additional convenient signature for this method that accepts a Iterable type:

public Builder addModifiers(Iterable<Modifier> modifiers) {
    checkNotNull(modifiers, "modifiers == null");
    for (Modifier modifier : modifiers) {
        this.modifiers.add(modifier);
    }
    return this;
}

I think it is appropriate to enhance FieldSpec and TypeSpec to also have such method signature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant