Package com.calebleavell.jatui.modules
Class NameOrModule
java.lang.Object
com.calebleavell.jatui.modules.NameOrModule
Stores either the module builder or the name of a module, which abstracts
module retrieving. See usage in
NumberedModuleSelector-
Constructor Summary
ConstructorsConstructorDescriptionNameOrModule(TUIModule.Builder<?> module) Sets the stored module to a concrete reference to a builder.NameOrModule(String moduleName) Sets the stored module to the name of a builder. -
Method Summary
Modifier and TypeMethodDescriptiongetCopy()Creates a new instance of thisNameOrModuleobject that remembers a copy of the module if a concrete reference was stored, or the same name if only the name was stored.Fetches the module that was inputted from either the concrete reference or the name.
-
Constructor Details
-
NameOrModule
Sets the stored module to a concrete reference to a builder.- Parameters:
module- The module to remember.
-
NameOrModule
Sets the stored module to the name of a builder.- Parameters:
moduleName- The name of the module to remember.
-
-
Method Details
-
getModule
Fetches the module that was inputted from either the concrete reference or the name. Requires the possible names to be a child ofapp.- Parameters:
app- The app that a potential name of the module would be a child of.- Returns:
- The remembered module.
-
getCopy
Creates a new instance of thisNameOrModuleobject that remembers a copy of the module if a concrete reference was stored, or the same name if only the name was stored.- Returns:
- The new copy of this instance.
-