From f1a9c133d91ea6df6fd16b7c59940eed83b6af35 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 12 Nov 2022 22:04:45 +0100 Subject: [PATCH] Continued: - avoided invoking method in constructor as this has side-effects (?) - sorted members --- .../mxchange/jcore/BaseFrameworkSystem.java | 19 +++++++++++++++++++ src/org/mxchange/jcore/facade/BaseFacade.java | 11 +++++++++++ .../application/ApplicationManager.java | 10 ++-------- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/org/mxchange/jcore/BaseFrameworkSystem.java b/src/org/mxchange/jcore/BaseFrameworkSystem.java index 55547f5..7895773 100644 --- a/src/org/mxchange/jcore/BaseFrameworkSystem.java +++ b/src/org/mxchange/jcore/BaseFrameworkSystem.java @@ -87,6 +87,25 @@ public abstract class BaseFrameworkSystem implements FrameworkInterface { protected BaseFrameworkSystem () { } + /** + * Constructor with Application instance + *

+ * @param application Application instance + */ + protected BaseFrameworkSystem (final Application application) { + // Call other constructor + this(); + + // Application instance must be set + if (null == application) { + // Abort here + throw new NullPointerException("application is null"); //NOI18N + } + + // Set application instance + this.application = application; + } + /** * Constructor with a facade *

diff --git a/src/org/mxchange/jcore/facade/BaseFacade.java b/src/org/mxchange/jcore/facade/BaseFacade.java index 3c45b98..93b8b62 100644 --- a/src/org/mxchange/jcore/facade/BaseFacade.java +++ b/src/org/mxchange/jcore/facade/BaseFacade.java @@ -17,6 +17,7 @@ package org.mxchange.jcore.facade; import org.mxchange.jcore.BaseFrameworkSystem; +import org.mxchange.jcore.application.Application; /** * A general manager @@ -32,4 +33,14 @@ public abstract class BaseFacade extends BaseFrameworkSystem implements Facade { protected BaseFacade () { } + /** + * Constructor with Application instance + *

+ * @param application Application instance + */ + protected BaseFacade (final Application application) { + // Call other constructor + super(application); + } + } diff --git a/src/org/mxchange/jcore/manager/application/ApplicationManager.java b/src/org/mxchange/jcore/manager/application/ApplicationManager.java index b439ebc..54b1a0e 100644 --- a/src/org/mxchange/jcore/manager/application/ApplicationManager.java +++ b/src/org/mxchange/jcore/manager/application/ApplicationManager.java @@ -62,14 +62,8 @@ public class ApplicationManager extends BaseFacade implements ManageableApplicat * @param application An instance of an Application class */ private ApplicationManager (final Application application) { - // Application instance must be set - if (null == application) { - // Abort here - throw new NullPointerException("application is null"); //NOI18N - } - - // Set application instance - this.setApplication(application); + // Invoke super constructor + super(application); } @Override -- 2.39.5