Class ErrorProneFlags
java.lang.Object
com.google.errorprone.ErrorProneFlags
- All Implemented Interfaces:
Serializable
Represents an immutable map of Error Prone flags to their set values.
All get* methods return an Optional<*> containing the value for the given key, or
empty if the flag is unset.
To access ErrorProneFlags from a BugChecker class, add a constructor to the class that takes one parameter of type ErrorProneFlags.
See documentation for full syntax description.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for Error Prone command-line flags object. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic ErrorProneFlags.Builderbuilder()static ErrorProneFlagsempty()static ErrorProneFlagsGets flag value for the given key as a String, wrapped in anOptional, which is empty if the flag is unset.getBoolean(String key) Gets the flag value for the given key as a Boolean, wrapped in anOptional, which is empty if the flag is unset.Gets the flag value for an enum of the given type, wrapped in anOptional, which is empty if the flag is unset.getEnumSet(String key, Class<T> clazz) Gets the flag value for a comma-separated set of enums of the given type, wrapped in anOptional, which is empty if the flag is unset.getInteger(String key) Gets the flag value for the given key as an Integer, wrapped in anOptional, which is empty if the flag is unset.com.google.common.collect.ImmutableList<String> getListOrEmpty(String key) Gets the flag value for the given key as a comma-separatedImmutableListof Strings, or an empty list if the flag is unset.com.google.common.collect.ImmutableSet<String> getSetOrEmpty(String key) Gets the flag value for the given key as a comma-separatedSetof Strings, or an empty set if unset.booleanisEmpty()Whether this Flags object is empty, i.e. no flags have been set.plus(ErrorProneFlags other) Returns a new ErrorProneFlags object with the values of two ErrorProneFlags objects added together.
-
Field Details
-
PREFIX
- See Also:
-
-
Method Details
-
empty
-
fromMap
-
getFlagsMap
-
get
-
getBoolean
Gets the flag value for the given key as a Boolean, wrapped in anOptional, which is empty if the flag is unset.The value within the
Optionalwill betrueif the flag's value is "true",falsefor "false", both case insensitive. If the value is neither "true" nor "false", throws anIllegalArgumentException.Note that any flag set without a value, e.g.
-XepOpt:FlagValue, will be "true". -
getEnum
-
getEnumSet
public <T extends Enum<T>> Optional<com.google.common.collect.ImmutableSet<T>> getEnumSet(String key, Class<T> clazz) Gets the flag value for a comma-separated set of enums of the given type, wrapped in anOptional, which is empty if the flag is unset. If the flag is explicitly set to empty, an empty set will be returned. -
getInteger
Gets the flag value for the given key as an Integer, wrapped in anOptional, which is empty if the flag is unset.If the flag's value cannot be interpreted as an Integer, throws a
NumberFormatException(note: float values will *not* be interpreted as integers and will throw an exception!) -
getListOrEmpty
-
getSetOrEmpty
-
isEmpty
public boolean isEmpty()Whether this Flags object is empty, i.e. no flags have been set. -
plus
Returns a new ErrorProneFlags object with the values of two ErrorProneFlags objects added together. For flags that appear in both instances, the values inotheroverridethis. -
builder
-