Class ProcessorOption<T>
java.lang.Object
be.imgn.gaia.processing.ProcessorOption<T>
- Type Parameters:
T- the type of the value
An option of an annotation processor, given to javac as
-Aname=value, with its type and default value.
static final ProcessorOption<Boolean> VERBOSE = ProcessorOption.ofBoolean("mapper.verbose", false);
// in the processor
protected Set<ProcessorOption<?>> options() {
return Set.of(VERBOSE);
}
// in a step
if (context.option(VERBOSE)) { ... }
-
Method Summary
Modifier and TypeMethodDescriptionReturns the value of this option when it is not given.name()Returns the name of this option.static ProcessorOption<Boolean> Returns a boolean option.static <E extends Enum<E>>
ProcessorOption<E> Returns an enum option, whose values are the names of the constants, in any case.static ProcessorOption<Integer> Returns an integer option.static ProcessorOption<String> Returns a text option.toString()
-
Method Details
-
ofString
Returns a text option.- Parameters:
name- the name of the option, as in-Aname=value: Java identifiers separated by dotsdefaultValue- the value when the option is not given- Returns:
- the option
- Throws:
IllegalArgumentException- ifnameis not Java identifiers separated by dots
-
ofBoolean
Returns a boolean option. Given without a value, as-Aname, it istrue.- Parameters:
name- the name of the option, as in-Aname=true: Java identifiers separated by dotsdefaultValue- the value when the option is not given- Returns:
- the option
- Throws:
IllegalArgumentException- ifnameis not Java identifiers separated by dots
-
ofInt
Returns an integer option.- Parameters:
name- the name of the option, as in-Aname=42: Java identifiers separated by dotsdefaultValue- the value when the option is not given- Returns:
- the option
- Throws:
IllegalArgumentException- ifnameis not Java identifiers separated by dots
-
ofEnum
public static <E extends Enum<E>> ProcessorOption<E> ofEnum(String name, Class<E> type, E defaultValue) Returns an enum option, whose values are the names of the constants, in any case.- Type Parameters:
E- the enum type- Parameters:
name- the name of the option, as in-Aname=constant: Java identifiers separated by dotstype- the enum classdefaultValue- the value when the option is not given- Returns:
- the option
- Throws:
IllegalArgumentException- ifnameis not Java identifiers separated by dots, ortypeis not an enum class
-
name
-
defaultValue
Returns the value of this option when it is not given.- Returns:
- the default value
-
toString
-