class Flag[T] extends AnyRef
A single command-line flag, instantiated by a com.twitter.app.Flags instance.
The current value can be extracted via apply(), get, and getWithDefault. Local-scoped modifications of their values, which can be useful for tests, can be done by calls to let and letClear.
Using a String-typed Flag, myFlag, which is unset and has a default
value of "DEFAULT" as an example:
myFlag.isDefined // => false myFlag.get // => None myFlag.getWithDefault // => Some("DEFAULT") myFlag() // => "DEFAULT" myFlag.let("a value") { myFlag.isDefined // => true myFlag.get // => Some("a value") myFlag.getWithDefault // => Some("a value") myFlag() // => "a value" myFlag.letClear { myFlag.isDefined // => false myFlag.get // => None myFlag.getWithDefault // => Some("DEFAULT") myFlag() // => "DEFAULT" } }
- See also
com.twitter.app.Flags for information on how flags can be set by the command line.
- Alphabetic
- By Inheritance
- Flag
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply(): T
Return this flag's current value.
Return this flag's current value. The default value is returned when the flag has not otherwise been set.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
defaultString(): String
String representation of this flag's default value
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
val
flaggable: Flaggable[T]
- Attributes
- protected
-
def
get: Option[T]
Get the value if it has been set.
Get the value if it has been set.
- Note
if no user-defined value has been set,
Nonewill be returned even when a default value is supplied.- See also
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getValue: Option[T]
- Attributes
- protected
-
def
getWithDefault: Option[T]
Get the value if it has been set or if there is a default value supplied.
Get the value if it has been set or if there is a default value supplied.
- See also
Flag.get and Flag.isDefined if you are interested in determining if there is a supplied value.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- val help: String
-
def
isDefined: Boolean
True if the flag has been set.
True if the flag has been set.
- Note
if no user-defined value has been set,
falsewill be returned even when a default value is supplied.
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
let[R](t: T)(f: ⇒ R): R
Override the value of this flag with
t, only for the scope of the current com.twitter.util.Local for the given functionf.Override the value of this flag with
t, only for the scope of the current com.twitter.util.Local for the given functionf. -
def
letClear[R](f: ⇒ R): R
Unset the value of this flag, such that isDefined will return
false, only for the scope of the current com.twitter.util.Local for the given functionf.Unset the value of this flag, such that isDefined will return
false, only for the scope of the current com.twitter.util.Local for the given functionf. -
def
letParse[R](arg: String)(f: ⇒ R): R
Override the value of this flag with
argparsed to this Flag's T type, only for the scope of the current com.twitter.util.Local for the given functionf.Override the value of this flag with
argparsed to this Flag's T type, only for the scope of the current com.twitter.util.Local for the given functionf. - val name: String
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
noArgumentOk: Boolean
Indicates whether or not the flag is valid without an argument.
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
parse(): Unit
Parse this flag with no argument.
-
def
parse(raw: String): Unit
Parse value
rawinto this flag. -
def
parsingDone: Boolean
- Attributes
- protected[this]
-
def
reset(): Unit
Reset this flag's value
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
String representation of this flag in -foo='bar' format, suitable for being used on the command line.
String representation of this flag in -foo='bar' format, suitable for being used on the command line.
- Definition Classes
- Flag → AnyRef → Any
- def usageString: String
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )