Skip to content

Replace class-level @FlagDesc with @InjectFlags #10

@yin

Description

@yin

The interface will mark a class as subject for Flag value injection during classpath scanning. It will also provide hints to the flag injector, like the flag variable prefix, intended to allow for more concise code.

public @interface InjectFlags {
  String prefix() default "";
}

The prefix hint allows for concise naming convention and resolves collisions with instance variables:

@InjectFlags(prefix = "flag_")
class MyThing {
    @FlagDesc("This tells me what to '--do'...")
    static Flag<String> flag_do = Flags.create("Rest!");

    final String do;

    MyThing() {
        this.do = flag_do.get();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions