Top Description Interfaces Annotations Classes Enums
[default module]

Package com.google.inject


Google Guice (pronounced "juice") is an ultra-lightweight dependency injection framework. Please refer to the Guice User's Guide for a gentle introduction.

The principal public APIs in this package are:

com.google.inject.Inject
The annotation you will use in your implementation classes to tell Guice where and how it should send in ("inject") the objects you depend on (your "dependencies").
com.google.inject.Module
The interface you will implement in order to specify "bindings" -- instructions for how Guice should handle injection -- for a particular set of interfaces.
com.google.inject.Binder
The object that Guice passes into your com.google.inject.Module to collect these bindings.
com.google.inject.Provider
The interface you will implement when you need to customize exactly how Guice creates instances for a particular binding.

Interface Summary

Modifier and TypeInterface and Description
public interface
Binder

Collects configuration information (primarily bindings) which will be used to create an Injector.

public interface
Binding<
the bound type. The injected is always assignable to this type.
T
>

A mapping from a Key to the strategy for getting instances of the type.

public interface
Injector

Builds the graphs of objects that make up your application.

public interface
MembersInjector<
type to inject members of
T
>

Injects dependencies into the fields and methods on instances of type T.

public interface
Module

A module contributes configuration information, typically interface bindings, which will be used to create an Injector.

public interface
PrivateBinder

Returns a binder whose configuration information is hidden from its environment by default.

public interface
Provider<
the type of object this provides
T
>

An object capable of providing instances of type T.

public interface
Scope

A scope is a level of visibility that instances provided by Guice may have.

Annotation Summary

Modifier and TypeAnnotation and Description
public @interface
BindingAnnotation

Annotates annotations which are used for binding.

public @interface
Exposed

Accompanies a @Provides method annotation in a private module to indicate that the provided binding is exposed.

public @interface
ImplementedBy

A pointer to the default implementation of a type.

public @interface
Inject

Annotates members of your implementation class (constructors, methods and fields) into which the Injector should inject values.

public @interface
ProvidedBy

A pointer to the default provider type for a type.

public @interface
Provides

Annotates methods of a Module to create a provider method binding.

public @interface
RestrictedBindingSource

Annotation restricting the binding of the target type to permitted sources.

public @interface
ScopeAnnotation

Annotates annotations which are used for scoping.

public @interface
Singleton

Apply this to implementation classes when you want only one instance (per Injector) to be reused for all injections for that binding.

Class Summary

Modifier and TypeClass and Description
public abstract class
AbstractModule

AbstractModule is a helper class used to add bindings to the Guice injector.

public class
ConfigurationException

Thrown when a programming error such as a misplaced annotation, illegal binding, or unsupported scope is found.

public class
CreationException

Thrown when errors occur while creating a Injector.

public class
Guice

The entry point to the Guice framework.

public class
Key<T>

Guice uses Key objects to identify a dependency that can be resolved by the Guice Injector.

public class
OutOfScopeException

Thrown from Provider#get when an attempt is made to access a scoped object while the scope in question is not currently active.

public abstract class
PrivateModule

A module whose configuration information is hidden from its environment by default.

public class
ProvisionException

Indicates that there was a runtime failure while providing an instance.

public class
Scopes

Built-in scope implementations.

public class
TypeLiteral<T>

Represents a generic type T.

Enum Summary

Modifier and TypeEnum and Description
public enum
Stage

The stage we're running in.