All Downloads are FREE. Search and download functionalities are using the official Maven repository.

roboguice.inject.ContextScopedProvider Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
package roboguice.inject;

import android.content.Context;

import com.google.inject.Inject;
import com.google.inject.Provider;


public class ContextScopedProvider {
    @Inject protected ContextScope scope;
    @Inject protected Provider provider;

    public T get(Context context) {
        synchronized (ContextScope.class) {
            scope.enter(context);
            try {
                return provider.get();
            } finally {
                scope.exit(context);
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy