in inject/inject-app/src/main/scala/com/twitter/inject/app/App.scala [36:103]
final def createFlag[T](
name: String,
default: T,
help: String,
flaggable: Flaggable[T]
): Flag[T] =
flag.create(name, default, help, flaggable)
/**
* A Java-friendly way to create a "mandatory" [[Flag]]. "Mandatory" flags MUST have a value
* provided as an application argument (as they have no default value to be used).
*
* @param name the name of the [[Flag]].
* @param help the help text explaining the purpose of the [[Flag]].
* @param usage a string describing the type of the [[Flag]], i.e.: Integer.
* @return the created [[Flag]].
*/
final def createMandatoryFlag[T](
name: String,
help: String,
usage: String,
flaggable: Flaggable[T]
): Flag[T] =
flag.createMandatory(name, help, usage, flaggable)
/**
* Called prior to application initialization.
*/
def onInit(): Unit = ()
/**
* Called before the `main` method.
*/
def preMain(): Unit = ()
/**
* Called after the `main` method.
*/
def postMain(): Unit = ()
/**
* Called prior to application exiting.
*/
def onExit(): Unit = ()
/**
* Called prior to application exiting after `onExit`.
*/
def onExitLast(): Unit = ()
init(onInit())
premain(preMain())
postmain(postMain())
onExit(onExit())
onExitLast(onExitLast())
}
/**
* A [[com.twitter.app.App]] that supports injection and [[com.twitter.inject.TwitterModule]] modules.
*
* It is not expected that you override @Lifecycle methods. If you do, take care to ensure that you
* call the super implementation, otherwise critical lifecycle set-up may not occur causing your application
* to either function improperly or outright fail.
*
* Typically, you will only need to interact with the following methods:
* run -- callback executed after the injector is created and all @Lifecycle methods have completed.
*/
trait App extends com.twitter.app.App with Slf4jBridge with Logging {