Class ErrorProneFlags
- All Implemented Interfaces:
Serializable
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
Modifier and TypeClassDescriptionstatic class
Builder for Error Prone command-line flags object. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ErrorProneFlags.Builder
builder()
static ErrorProneFlags
empty()
static ErrorProneFlags
Gets 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-separatedImmutableList
of 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-separatedSet
of Strings, or an empty set if unset.boolean
isEmpty()
Whether this Flags object is empty, i.e.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
Optional
will betrue
if the flag's value is "true",false
for "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 inother
overridethis
. -
builder
-