public class FlagProp extends PropertyBase<Boolean>
This would be used for command line arguments that are true by being presence, e.g.:
java MyClass launch
If launch is the name or alias of a FlagProp, launch will true by its presence,
without requiring launch=true (although that will also work).
NOTE: The behavior of this class may be changing
The existing behavior causes unexpected values in properties files and will likely
change in the 0.5.0 release
so that it behaves like a BolProp everywhere except on command line.
If unspecified, a Flag defaults to false, however, the default can be set to true (but not to null).
A FlagProp is similar to a BolProp, but with these differences:
propertyName=false.
launch =
If after trimming the value is not null, it is parsed by
TextUtil.toBoolean(java.lang.String) to
determine if the String is considered true or false.
| Modifier and Type | Class and Description |
|---|---|
static class |
FlagProp.FlagBuilder |
| Constructor and Description |
|---|
FlagProp(Boolean defaultValue,
String shortDesc,
List<Name> aliases,
PropertyType paramType,
ValueType<Boolean> valueType,
Trimmer trimmer,
String helpText) |
| Modifier and Type | Method and Description |
|---|---|
static FlagProp.FlagBuilder |
builder()
A chainable builder for this property that should terminate with
build() |
Boolean |
getValue()
Returns the effective value of this property.
|
getDefaultValue, getDescription, getExplicitValue, getHelpText, getPropertyType, getRequestedAliases, getTrimmer, getValidators, getValueType, isNonNullRequiredclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCanonicalName, getInAliases, getOutAliases, getValueAsString, isExplicitlySetpublic Boolean getValue()
Propertypublic static FlagProp.FlagBuilder builder()
build()
Use as FlagProp.builder()...series of builder methods...build();
Copyright © 2021. All rights reserved.