allow force-init
authorNiki Roo <niki@nikiroo.be>
Sat, 18 May 2019 16:07:54 +0000 (18:07 +0200)
committerNiki Roo <niki@nikiroo.be>
Sat, 18 May 2019 16:07:54 +0000 (18:07 +0200)
src/be/nikiroo/fanfix/Instance.java

index 8a2ed98a702144f1ece1c135964881435fd0952f..96d5d6f9a3031124cce38f8d59f81ea53138df2e 100644 (file)
@@ -47,11 +47,32 @@ public class Instance {
        /**
         * Initialise the instance -- if already initialised, nothing will happen.
         * <p>
-        * Before calling this method, you may call {@link Bundles#setDirectory()}
-        * if wanted.
+        * Before calling this method, you may call
+        * {@link Bundles#setDirectory(String)} if wanted.
         */
        static public void init() {
-               if (init) {
+               init(false);
+       }
+
+       /**
+        * Initialise the instance -- if already initialised, nothing will happen
+        * unless you pass TRUE to <tt>force</tt>.
+        * <p>
+        * Before calling this method, you may call
+        * {@link Bundles#setDirectory(String)} if wanted.
+        * <p>
+        * Note: forcing the initialisation can be dangerous, so make sure to only
+        * make it under controlled circumstances -- for instance, at the start of
+        * the program, you could call {@link Instance#init()}, change some settings
+        * because you want to force those settings (it will also forbid users to
+        * change them!) and then call {@link Instance#init(boolean)} with
+        * <tt>force</tt> set to TRUE.
+        * 
+        * @param force
+        *            force the initialisation even if already initialised
+        */
+       static public void init(boolean force) {
+               if (init && !force) {
                        return;
                }