@@ -0,0 +1,2024 @@
+/*%0A * Copyright 2015 Michael Rozumyanskiy%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.michaelrocks.lightsaber.internal;%0A%0Aimport com.michaelrocks.lightsaber.ConfigurationException;%0Aimport com.michaelrocks.lightsaber.Injector;%0A%0Aimport javax.inject.Provider;%0Aimport java.util.IdentityHashMap;%0Aimport java.util.Map;%0A%0Apublic class LightsaberInjector implements Injector %7B%0A    private final Map%3CClass%3C?%3E, Provider%3C?%3E%3E providers = new IdentityHashMap%3CClass%3C?%3E, Provider%3C?%3E%3E();%0A%0A    public LightsaberInjector() %7B%0A    %7D%0A%0A    @Override%0A    public void injectMembers(final Object target) %7B%0A        throw new IllegalStateException(%0A                %22This method must not be called. It must be substituted with a valid injector instead.%22);%0A    %7D%0A%0A    @Override%0A    public %3CT%3E T getInstance(final Class%3CT%3E type) %7B%0A        return getProvider(type).get();%0A    %7D%0A%0A    @Override%0A    public %3CT%3E Provider%3CT%3E getProvider(final Class%3CT%3E type) %7B%0A        // noinspection unchecked%0A        final Provider%3CT%3E provider = (Provider%3CT%3E) providers.get(type);%0A        if (provider == null) %7B%0A            throw new ConfigurationException(%22Provider for %22 + type + %22 not found%22);%0A        %7D%0A        return provider;%0A    %7D%0A%0A    public %3CT%3E void registerProvider(final Class%3CT%3E type, final Provider%3CT%3E provider) %7B%0A        final Provider%3C?%3E oldProvider = providers.put(type, provider);%0A        if (oldProvider != null) %7B%0A            throw new ConfigurationException(%22Provider for %22 + type + %22 already registered%22);%0A        %7D%0A    %7D%0A%7D%0A

Add simple Injector implementation