Static class or instance as parameter?
<p>i just wanted to know whats the best solution is (The class Framework can only exist once, it holds the configuration etc)</p>

<p>Lets assume the following (static):</p>

<pre><code>public class Framework {
    private Framework() {}

    private static String something;
    private static Object somethingElse;

    public static synchronized void init() {
        something = "something";
        somethingElse = new SuperFancyObject();
    }

    public static String getSomething() { return something; }
    public static Object getSomethingElse() { return somethingElse; }
}
</code></pre>

<p>Now i can use all methods inside that class anywhere by calling:</p>

<pre><code>public void invoke(Request request, Response response) {
    ...
    Framework.getSomething();
    ...
}
</code></pre>

<p>The other solution would be:</p>

<pre><code>public class Framework {
    private static String something;
    private static Object somethingElse;

    public Framework() {
        something = "something";
        somethingElse = new SuperFancyObject();
    }

    public String getSomething() { return something; }
    public Object getSomethingElse() { return somethingElse; }
}
</code></pre>

<p>So now, to use that, i must pass the object/class as a parameter:</p>

<pre><code>public void invoke(Framework framework, Request request, Response response) {
    ...
    framework.getSomething();
    ...
}
</code></pre>

<p>The maybe third solution would be the static + singleton.</p>

<p>What i want to know now is, which is the better, more clean (maybe sexy) solution or which you prefer?</p>

<p>Thanks!</p>
