From af4777a1f3e790ebe1352d24dda27559e130499f Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 30 Sep 2015 08:57:17 +0200 Subject: [PATCH] =?utf8?q?Introduced=20new=20exception=20MenuInitializatio?= =?utf8?q?nException=20Signed-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../jcore/application/Application.java | 5 ++- .../MenuInitializationException.java | 40 +++++++++++++++++++ .../application/ApplicationManager.java | 3 +- .../application/ManageableApplication.java | 5 ++- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 src/org/mxchange/jcore/exceptions/MenuInitializationException.java diff --git a/src/org/mxchange/jcore/application/Application.java b/src/org/mxchange/jcore/application/Application.java index ddc52aa..9d01f77 100644 --- a/src/org/mxchange/jcore/application/Application.java +++ b/src/org/mxchange/jcore/application/Application.java @@ -19,6 +19,7 @@ package org.mxchange.jcore.application; import java.io.IOException; import java.sql.SQLException; import org.mxchange.jcore.FrameworkInterface; +import org.mxchange.jcore.exceptions.MenuInitializationException; /** * @@ -33,8 +34,10 @@ public interface Application extends FrameworkInterface { /** * Run the main loop + *

+ * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the menu could not be initialized */ - public void doMainLoop (); + public void doMainLoop () throws MenuInitializationException; /** * Shutdown the application diff --git a/src/org/mxchange/jcore/exceptions/MenuInitializationException.java b/src/org/mxchange/jcore/exceptions/MenuInitializationException.java new file mode 100644 index 0000000..d1727b2 --- /dev/null +++ b/src/org/mxchange/jcore/exceptions/MenuInitializationException.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.jcore.exceptions; + +/** + * This exception is thrown when the menu cannot be initialized. + *

+ * @author Roland Haeder + */ +public class MenuInitializationException extends Exception { + + /** + * Serial number + */ + private static final long serialVersionUID = 24_783_787_818_459_283L; + + /** + * Constructor for bad menu instance and type + *

+ * @param menu Bad menu instance (not implementing Menu) + * @param menuType Menu type + */ + public MenuInitializationException (final Object menu, final String menuType) { + } + +} diff --git a/src/org/mxchange/jcore/manager/application/ApplicationManager.java b/src/org/mxchange/jcore/manager/application/ApplicationManager.java index 84ff96d..c20012b 100644 --- a/src/org/mxchange/jcore/manager/application/ApplicationManager.java +++ b/src/org/mxchange/jcore/manager/application/ApplicationManager.java @@ -17,6 +17,7 @@ package org.mxchange.jcore.manager.application; import org.mxchange.jcore.application.Application; +import org.mxchange.jcore.exceptions.MenuInitializationException; import org.mxchange.jcore.manager.BaseManager; /** @@ -77,7 +78,7 @@ public class ApplicationManager extends BaseManager implements ManageableApplica } @Override - public void start () { + public void start () throws MenuInitializationException { // Bootstrap application this.getApplication().doBootstrap(); diff --git a/src/org/mxchange/jcore/manager/application/ManageableApplication.java b/src/org/mxchange/jcore/manager/application/ManageableApplication.java index 24dfe6c..9c91fe7 100644 --- a/src/org/mxchange/jcore/manager/application/ManageableApplication.java +++ b/src/org/mxchange/jcore/manager/application/ManageableApplication.java @@ -16,6 +16,7 @@ */ package org.mxchange.jcore.manager.application; +import org.mxchange.jcore.exceptions.MenuInitializationException; import org.mxchange.jcore.manager.Manageable; /** @@ -27,6 +28,8 @@ public interface ManageableApplication extends Manageable { /** * Launches application + *

+ * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the menu could not be initialized */ - public void start (); + public void start () throws MenuInitializationException; } -- 2.39.5