abstract class JavaGlobalFlag[T] extends GlobalFlag[T]
- Alphabetic
- By Inheritance
- JavaGlobalFlag
- GlobalFlag
- Flag
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
JavaGlobalFlag(help: String, flaggable: Flaggable[T], clazz: Class[T])
A flag without a default value.
A flag without a default value.
_declaration
In order to declare a new GlobalFlag in Java, it can be done with a bit of ceremony by following a few steps:
1. the flag's class name must end with "$", e.g.
javaGlobalWithDefault$. This is done to mimic the behavior of Scala's singletonobject. 1. the class must have a method,public static Flag<?> globalFlagInstance(), that returns the singleton instance of the Flag. 1. the class should have astatic finalfield holding the singleton instance of the flag. 1. the class should extendJavaGlobalFlag. 1. to avoid extraneous creation of instances, thus forcing users to only access the singleton, the constructor should beprivateand the class should bepublic final.An example of a GlobalFlag declared in Java:
import com.twitter.app.Flag; import com.twitter.app.Flaggable; import com.twitter.app.JavaGlobalFlag; public final class exampleJavaGlobalFlag$ extends JavaGlobalFlag<String> { private exampleJavaGlobalFlag() { super("The default value", "The help string", Flaggable.ofString()); } public static final Flag<String> Flag = new exampleJavaGlobalFlag(); public static Flag<?> globalFlagInstance() { return Flag; } }
_declaration
- help
documentation regarding usage of this flag.
- clazz
the type of the flag
- Attributes
- protected
-
new
JavaGlobalFlag(default: T, help: String, flaggable: Flaggable[T])
A flag with a default value.
A flag with a default value.
_declaration
In order to declare a new GlobalFlag in Java, it can be done with a bit of ceremony by following a few steps:
1. the flag's class name must end with "$", e.g.
javaGlobalWithDefault$. This is done to mimic the behavior of Scala's singletonobject. 1. the class must have a method,public static Flag<?> globalFlagInstance(), that returns the singleton instance of the Flag. 1. the class should have astatic finalfield holding the singleton instance of the flag. 1. the class should extendJavaGlobalFlag. 1. to avoid extraneous creation of instances, thus forcing users to only access the singleton, the constructor should beprivateand the class should bepublic final.An example of a GlobalFlag declared in Java:
import com.twitter.app.Flag; import com.twitter.app.Flaggable; import com.twitter.app.JavaGlobalFlag; public final class exampleJavaGlobalFlag$ extends JavaGlobalFlag<String> { private exampleJavaGlobalFlag() { super("The default value", "The help string", Flaggable.ofString()); } public static final Flag<String> Flag = new exampleJavaGlobalFlag(); public static Flag<?> globalFlagInstance() { return Flag; } }
_declaration
- default
the default value used if the value is not specified by the user.
- help
documentation regarding usage of this flag.
- Attributes
- protected
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.
- Definition Classes
- Flag
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
defaultString(): String
String representation of this flag's default value
String representation of this flag's default value
- Definition Classes
- Flag
-
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
- Definition Classes
- Flag
-
def
get: Option[T]
Get the value if it has been set.
Get the value if it has been set.
- Definition Classes
- Flag
- 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
-
def
getGlobalFlag: Flag[_]
Used by Flags.parseArgs to initialize Flag values.
Used by Flags.parseArgs to initialize Flag values.
- Definition Classes
- GlobalFlag
- Note
Called via reflection assuming it will be a
staticmethod on a singletonobject. This causes problems for Java developers who want to create a GlobalFlag as there is no good means for them to have it be astaticmethod. Thus, Java devs must add a methodpublic static Flag<?> globalFlagInstance()which returns the singleton instance of the flag. See JavaGlobalFlag for more details.
-
def
getValue: Option[T]
- Attributes
- protected
- Definition Classes
- GlobalFlag → Flag
-
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.
- Definition Classes
- Flag
- 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
-
val
help: String
- Definition Classes
- Flag
-
def
isDefined: Boolean
True if the flag has been set.
True if the flag has been set.
- Definition Classes
- Flag
- 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(t: T)(f: ⇒ Unit): Unit
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(f: ⇒ Unit): Unit
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. -
val
name: String
The "name", or "id", of this Flag.
The "name", or "id", of this Flag.
While not marked
final, if a subclass overrides this value, then developers must set that flag via System properties as otherwise it will not be recognized with command-line arguments. e.g.-DyourGlobalFlagName=flagName- Definition Classes
- GlobalFlag → Flag
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
noArgumentOk: Boolean
Indicates whether or not the flag is valid without an argument.
Indicates whether or not the flag is valid without an argument.
- Definition Classes
- Flag
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
parse(): Unit
Parse this flag with no argument.
Parse this flag with no argument.
- Definition Classes
- Flag
-
def
parse(raw: String): Unit
Parse value
rawinto this flag.Parse value
rawinto this flag.- Definition Classes
- Flag
-
def
parsingDone: Boolean
- Attributes
- protected[this]
- Definition Classes
- GlobalFlag → Flag
-
def
reset(): Unit
Reset this flag's value
Reset this flag's value
- Definition Classes
- Flag
-
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
- Definition Classes
- Flag
-
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
- @throws( ... )