From 932a6827e73b56d55ae5fc2f1c1a1fa9aa136518 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 15 Oct 2015 09:43:04 +0200 Subject: [PATCH] =?utf8?q?Cleanup=20through=20inspection=20Signed-off-by:R?= =?utf8?q?oland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../mxchange/jcore/BaseFrameworkSystem.java | 147 +++++++++--------- .../mxchange/jcore/FrameworkInterface.java | 10 +- .../jcore/application/Application.java | 6 +- src/org/mxchange/jcore/client/Client.java | 12 +- src/org/mxchange/jcore/facade/Facade.java | 2 +- .../application/ManageableApplication.java | 2 +- 6 files changed, 90 insertions(+), 89 deletions(-) diff --git a/src/org/mxchange/jcore/BaseFrameworkSystem.java b/src/org/mxchange/jcore/BaseFrameworkSystem.java index 7276e42..481508f 100644 --- a/src/org/mxchange/jcore/BaseFrameworkSystem.java +++ b/src/org/mxchange/jcore/BaseFrameworkSystem.java @@ -39,6 +39,26 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { */ private static FrameworkInterface selfInstance; + /** + * Getter for this application + *

+ * @return Instance from this application + */ + public static FrameworkInterface getInstance () { + // Return it + return selfInstance; + } + + /** + * Checks if the bundle is initialized + *

+ * @return Whether the bundle has been initialized + */ + protected static boolean isBundledInitialized () { + // Check it + return (bundle instanceof ResourceBundle); + } + /** * Application instance */ @@ -68,19 +88,56 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { protected BaseFrameworkSystem () { } + @Override + public Application getApplication () { + return this.application; + } + + @Override + public Facade getFacade () { + return this.facade; + } + + @Override + public String getMessageStringFromKey (final String key) { + // Return message + return this.getBundle().getString(key); + } + /** - * Getter for this application + * Getter for bundle instance *

- * @return Instance from this application + * @return Resource bundle */ - public static FrameworkInterface getInstance () { - // Return it - return selfInstance; + protected ResourceBundle getBundle () { + return BaseFrameworkSystem.bundle; } - @Override - public Application getApplication () { - return this.application; + /** + * Setter for bundle instance + *

+ * @param bundle the bundle to set + */ + protected static void setBundle (final ResourceBundle bundle) { + BaseFrameworkSystem.bundle = bundle; + } + + /** + * Manager instance + *

+ * @param facade the facade instance to set + */ + protected void setFacade (final Facade facade) { + this.facade = facade; + } + + /** + * Application instance + *

+ * @param application the application to set + */ + protected void setApplication (final Application application) { + this.application = application; } @Override @@ -88,6 +145,15 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { return this.client; } + /** + * Client instance + *

+ * @param client the client to set + */ + protected void setClient (final Client client) { + this.client = client; + } + /** * Converts null to empty string or leaves original object untouched. *

@@ -137,62 +203,6 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { return tokens; } - /** - * Client instance - *

- * @param client the client to set - */ - protected void setClient (final Client client) { - this.client = client; - } - - /** - * Application instance - *

- * @param application the application to set - */ - protected void setApplication (final Application application) { - this.application = application; - } - - @Override - public Facade getFacade () { - return this.facade; - } - - /** - * Manager instance - *

- * @param facade the facade instance to set - */ - protected void setFacade (final Facade facade) { - this.facade = facade; - } - - @Override - public String getMessageStringFromKey (final String key) { - // Return message - return this.getBundle().getString(key); - } - - /** - * Getter for bundle instance - *

- * @return Resource bundle - */ - protected ResourceBundle getBundle () { - return BaseFrameworkSystem.bundle; - } - - /** - * Setter for bundle instance - *

- * @param bundle the bundle to set - */ - protected static void setBundle (final ResourceBundle bundle) { - BaseFrameworkSystem.bundle = bundle; - } - /** * Initializes i18n bundles */ @@ -207,13 +217,4 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { setBundle(ResourceBundle.getBundle(FrameworkInterface.I18N_BUNDLE_FILE)); // NOI18N } - /** - * Checks if the bundle is initialized - *

- * @return Whether the bundle has been initialized - */ - protected static boolean isBundledInitialized () { - // Check it - return (bundle instanceof ResourceBundle); - } } diff --git a/src/org/mxchange/jcore/FrameworkInterface.java b/src/org/mxchange/jcore/FrameworkInterface.java index 612c6bb..fae3265 100644 --- a/src/org/mxchange/jcore/FrameworkInterface.java +++ b/src/org/mxchange/jcore/FrameworkInterface.java @@ -30,28 +30,28 @@ public interface FrameworkInterface { /** * File name (and path) for internalization bundle */ - public static final String I18N_BUNDLE_FILE = "org/mxchange/localization/bundle"; //NOI18N + String I18N_BUNDLE_FILE = "org/mxchange/localization/bundle"; //NOI18N /** * Application instance *

* @return the application */ - public Application getApplication (); + Application getApplication (); /** * Client instance *

* @return the client */ - public Client getClient (); + Client getClient (); /** * Getter for manager *

* @return Manager instance */ - public Facade getFacade (); + Facade getFacade (); /** * Getter for human-readable string from given key @@ -60,5 +60,5 @@ public interface FrameworkInterface { *

* @return Human-readable message */ - public String getMessageStringFromKey (final String key); + String getMessageStringFromKey (final String key); } diff --git a/src/org/mxchange/jcore/application/Application.java b/src/org/mxchange/jcore/application/Application.java index 4d45b2e..c9883b2 100644 --- a/src/org/mxchange/jcore/application/Application.java +++ b/src/org/mxchange/jcore/application/Application.java @@ -30,7 +30,7 @@ public interface Application extends FrameworkInterface { /** * Bootstraps the application */ - public void doBootstrap (); + void doBootstrap (); /** * Run the main loop @@ -38,7 +38,7 @@ public interface Application extends FrameworkInterface { * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the * menu could not be initialized */ - public void doMainLoop () throws MenuInitializationException; + void doMainLoop () throws MenuInitializationException; /** * Shutdown the application @@ -46,5 +46,5 @@ public interface Application extends FrameworkInterface { * @throws java.io.IOException If an IO error occurs * @throws java.sql.SQLException If a SQL error occurs */ - public void doShutdown () throws IOException, SQLException; + void doShutdown () throws IOException, SQLException; } diff --git a/src/org/mxchange/jcore/client/Client.java b/src/org/mxchange/jcore/client/Client.java index 40ead40..a6ff2c3 100644 --- a/src/org/mxchange/jcore/client/Client.java +++ b/src/org/mxchange/jcore/client/Client.java @@ -33,34 +33,34 @@ public interface Client extends FrameworkInterface { * @throws java.io.IOException If an IO error occurs * @throws java.sql.SQLException If a SQL error occurs */ - public void doShutdown () throws IOException, SQLException; + void doShutdown () throws IOException, SQLException; /** * Enables isRunning attribute which singals that the client is running */ - public void enableIsRunning (); + void enableIsRunning (); /** * Inizializes this client */ - public void init (); + void init (); /** * Determines whether the client is still active by checking some conditions *

* @return Whether the client is still active */ - public boolean isRunning (); + boolean isRunning (); /** * Displays a message to the user *

* @param message Message to show to the user */ - public void outputMessage (final String message); + void outputMessage (final String message); /** * Shows introduction to user */ - public void showWelcome (); + void showWelcome (); } diff --git a/src/org/mxchange/jcore/facade/Facade.java b/src/org/mxchange/jcore/facade/Facade.java index 315329c..3be7f49 100644 --- a/src/org/mxchange/jcore/facade/Facade.java +++ b/src/org/mxchange/jcore/facade/Facade.java @@ -33,5 +33,5 @@ public interface Facade extends FrameworkInterface { * @throws java.sql.SQLException If an SQL error occurs * @throws java.io.IOException If an IO error occurs */ - public void doShutdown () throws SQLException, IOException; + void doShutdown () throws SQLException, IOException; } diff --git a/src/org/mxchange/jcore/manager/application/ManageableApplication.java b/src/org/mxchange/jcore/manager/application/ManageableApplication.java index ee11eaa..8bc07a1 100644 --- a/src/org/mxchange/jcore/manager/application/ManageableApplication.java +++ b/src/org/mxchange/jcore/manager/application/ManageableApplication.java @@ -32,5 +32,5 @@ public interface ManageableApplication extends Facade { * @throws org.mxchange.jcore.exceptions.MenuInitializationException If the * menu could not be initialized */ - public void start () throws MenuInitializationException; + void start () throws MenuInitializationException; } -- 2.39.5