Package jmri.util.startup
Interface StartupModel
-
- All Known Implementing Classes:
AbstractActionModel
,AbstractStartupModel
,CreateButtonModel
,PerformActionModel
,PerformFileModel
,PerformScriptModel
,ScriptButtonModel
,StartupPauseModel
,TriggerRouteModel
public interface StartupModel
Startup object models all need to implement this interface. This allows theStartupActionsManager
to handle lists of different model classes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addException(java.lang.Exception exception)
Add an exception to the list of exceptions thrown when loading the model or performing the action.java.util.List<java.lang.Exception>
getExceptions()
Get the exceptions thrown by the startup model.java.lang.String
getName()
Return the name of of the model or its controlled object.boolean
isEnabled()
Get whenether this action is enabled or not.boolean
isValid()
Test is model is a valid model.void
performAction()
Perform the startup action.void
setEnabled(boolean value)
Set whenether this action is enabled or not.void
setName(java.lang.String name)
Set the name of the model.
-
-
-
Method Detail
-
getName
@CheckForNull java.lang.String getName()
Return the name of of the model or its controlled object.- Returns:
- the name, an empty string, or null
-
setName
void setName(@CheckForNull java.lang.String name)
Set the name of the model.- Parameters:
name
- the name, an empty string, or null
-
isValid
boolean isValid()
Test is model is a valid model. Invalid models will not be shown or saved by the Startup Actions Preferences panel.- Returns:
- true if valid; false otherwise
-
setEnabled
void setEnabled(boolean value)
Set whenether this action is enabled or not.- Parameters:
value
- true if enabled, false otherwise
-
isEnabled
boolean isEnabled()
Get whenether this action is enabled or not.- Returns:
- true if enabled, false otherwise
-
performAction
void performAction() throws JmriException
Perform the startup action. The caller is responsible to ensure that this startup model is enabled before calling this method.- Throws:
JmriException
- if there is an exception thrown initializing the startup item; the original exception should be available asThrowable.getCause()
-
getExceptions
@Nonnull java.util.List<java.lang.Exception> getExceptions()
Get the exceptions thrown by the startup model.- Returns:
- the list of exceptions thrown during startup in order or an empty list if no exceptions were thrown
-
addException
void addException(@Nonnull java.lang.Exception exception)
Add an exception to the list of exceptions thrown when loading the model or performing the action.- Parameters:
exception
- the exception to retain with the model
-
-