From: Roland Häder Date: Sat, 12 Nov 2022 21:04:45 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f1a9c133d91ea6df6fd16b7c59940eed83b6af35;p=jcore.git Continued: - avoided invoking method in constructor as this has side-effects (?) - sorted members --- 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