Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant