|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagecom.google.inject.spi
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Visits each of the strategies used to scope an injection. @paramClass BindingScopingVisitor, V visitNoScoping()any type to be returned by the visit method. Use Void withwith{@code return null} if no return type is needed. @since 2.0
Visit an unspecified or unscoped strategy. On a module, this strategy indicates that the injector should use scoping annotations to find a scope. On an injector, it indicatesthat nothat no scope is applied to the binding. An unscoped binding will behave like a scoped one whenititisis linked to a scoped binding.
Visits each of the strategies used to find an instance to satisfy an injection. @paramClass BindingTargetVisitor, V visit(ConvertedConstantBinding<? extends T>)any type to be returned by the visit method. Use Void withwith{@code return null} if no return type is needed. @since 2.0
Visit a binding created from converting a bound instance to a new type. The sourceClass BindingTargetVisitor, V visit(LinkedKeyBinding<? extends T>)binding hasbinding has the same binding annotation but a different type. This target is found only on injector bindings.
Visit a linked key binding. The other key's binding is used to resolve injections.Class BindingTargetVisitor, V visit(UntargettedBinding<? extends T>)This targetThis target is found in both module and injector bindings.
Visit an untargetted binding. This target is found only on module bindings. Itindicates thatindicates that the injector should use its implicit binding strategies to resolve injections.
Returns all instance method and field injection points on {@code type}. @return a possibly empty set of injection points. The set has a specified iteration order. Allfields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods.
Returns the type converter binding used to convert the constant.@since 3.0
No-op visitor for subclassing. All interface methods simply delegatetoto .visitOther(), returning its result. @paramany type to be returned by the visit method. Use Void withwith{@code return null} if no return type is needed.@author jessewilson@google.com (Jesse Wilson) @since 2.0
No-op visitor for subclassing. All interface methods simply delegate to .visitOther(Binding), returning its result. @paramany type to be returned by the visit method. Use Void withwith{@code return null} if no return type is needed.@author jessewilson@google.com (Jesse Wilson) @since 2.0
No-op visitor for subclassing. All interface methods simply delegatetoto .visitOther(Element), returning its result. @paramany type to be returned by the visit method. Use Void withwith{@code return null} if no return type is needed.@author sberlin@gmail.com (Sam Berlin) @since 2.0
A combination of a Dependency and theClass DependencyAndSource, String getBindingSource()source wherethethe dependency was bound.@author sameb@google.com (Sam Berlin) @since 4.00 @deprecated The only use of this object is for ProvisionListener.ProvisionInvocation.getDependencyChain() which is also deprecated. This object will also be removed in Guice 4.4.
Returns a string describing where this dependency was bound. If theClass DependencyAndSource, Dependency<?> getDependency()bindingbinding was just-in-time, there is no valid binding source, so this describesthethe class in question.
Returns the Dependency, if one exists. For anything that can bereferencedreferenced by Injector.getBinding, a dependency exists. A dependency willnotnot exist (and this willreturnreturn null) for types initializedwithwith Binder.requestInjection or Injector.injectMembers(Object),nor will it exist for objects injected into Providersbound withbound with LinkedBindingBuilder#toProvider(Provider).
Contains information about where and how an elementClass ElementSource, Object getDeclaringSource()waswas bound.
The declaring source refers to a locationinin source codethatthat defines the Guice element. For example,ifif the element is created from amethodmethod annotated by {@literal @Provides},thethe declaring source of element would be the method itself.
The .getStackTrace() refers to the sequence of calls ends at oneofof com.google.inject.Binder {@code bindXXX()} methods andeventuallyeventually defines the element. Notethatthat .getStackTrace()listslists StackTraceElements inreversereverse chronological order.The first element (index zero) is the last method call and the last element is the first method invocation. By default, the stack trace is not collected.Thedefaultdefault behavior can be changed by settingthethe {@code guice_include_stack_traces} flag value. Thevaluevalue can beeithereither {@code OFF}, {@code ONLY_FOR_DECLARING_SOURCE} or {@code COMPLETE}. Note that collecting stack traces for every binding can cause a performance hitwhenwhen the injectorisis created.
The sequence of class names of modulesinvolved inthethe element creation can be retrievedbyby .getModuleClassNames(). Similar to .getStackTrace(),thethe order is reverse chronological. The first module (index 0) is themodulemodulethatthat installs the element. The last module is the root module.
In order to support the cases where a Guice elementisis created fromanotheranother Guice element (original) (e.g.,byby Element.applyTo), it also providesaa reference to theoriginaloriginal element source (.getOriginalElementSource()). @since 4.0
Returns a single location in source code that defines the element. It can be anyClass ElementSource, List<String> getModuleClassNames()objectobject suchasas java.lang.reflect.Constructor, java.lang.reflect.Method,java.lang.reflect.Field, StackTraceElement, etc.ForFor example, if the elementisis created from a method annotated by {@literal @Provides},thethe declaring source of elementwouldwould be the method itself.
Returns the class names of modules involved in creating this Element. TheClass ElementSource, List<Integer> getModuleConfigurePositionsInStackTrace()first elementfirst element (index 0) is the class name of module that defined the element, and the lastelementelement isthethe class name of root module.
Returns the position of configure(Binder) method call in the stack trace for modules that their classes returned by .getModuleClassNames. For example, if the stack trace looks like the following:Class ElementSource, StackTraceElement[] getStackTrace()
{@code0-{@code Binder.bind() ,}1-{@code ModuleTwo.configure() ,}2-{@code Binder.install() ,}3-{@code ModuleOne.configure() ,}4-{@code theRest(). }
1 and 3 are returned.
In the cases where stack trace is not available (i.e., the stack trace was not collected), it returns -1 for all module positions.
Returns the sequence of method calls that ends at one of com.google.inject.Binder {@code bindXXX()} methods and eventually defines the element. Notethatthat .getStackTrace lists StackTraceElements inreversereverse chronological order. Thefirstfirst element (index zero) is the last method call and thelastlast element is the firstmethodmethod invocation. In the cases where stack trace is notavailableavailable (i.e.,the stack trace wasnotnot collected), it returns an empty array.
Visit elements. @paramClass ElementVisitor, V visit(Binding<T>)any type to be returned by the visit method. Use Void withwith{@code return null} if no return type is needed.@since 2.0
Visit a mapping from a key (type and optional annotation) to the strategy forClass ElementVisitor, V visit(DisableCircularProxiesOption)getting instancesgetting instances of the type.
Visit a disable circular proxies command.Class ElementVisitor, V visit(RequireAtInjectOnConstructorsOption)@since 3.0
Visit a require explicit {@literal @}Inject command.Class ElementVisitor, V visit(RequireExplicitBindingsOption)@since 4.0
Visit a require explicit bindings command.@since 3.0
Returns the known dependencies for this type. If this has dependencies whose values are not known statically, a dependency for the Injector will be included in the returned set.@return a possibly empty set
Returns a new injection point for the specified constructor. If the declaring type of {@code constructor} is parameterized (such as {@code ListClass InjectionPoint, InjectionPoint forConstructor(Constructor<T>, TypeLiteral<? extends T>)}), prefer the overload that includes a type literal. @param constructor any single constructor present on {@code type}. @since 3.0
Returns a new injection point for the specified constructor of {@code type}. @param constructor any single constructor present on {@code type}. @param type the concrete type that defines {@code constructor}.Class InjectionPoint, Set<InjectionPoint> forInstanceMethodsAndFields(Class<?>)@since 3.0
Returns all instance method and field injection points on {@code type}. @return a possibly empty set of injection points. The set has a specified iteration order. AllClass InjectionPoint, Set<InjectionPoint> forInstanceMethodsAndFields(TypeLiteral<?>)fields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods. @throws ConfigurationException if there is a malformed injection point on {@code type}, such asa field with multiple binding annotations. The exception's partial value is a {@code Set} ofofthe valid injection points.
Returns all instance method and field injection points on {@code type}. @return a possibly empty set of injection points. The set has a specified iteration order. AllClass InjectionPoint, InjectionPoint forMethod(Method, TypeLiteral<T>)fields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods. @throws ConfigurationException if there is a malformed injection point on {@code type}, such asa field with multiple binding annotations. The exception's partial value is a {@code Set} ofofthe valid injection points.
Returns a new injection point for the specified method of {@code type}.Class InjectionPoint, Set<InjectionPoint> forStaticMethodsAndFields(Class<?>)This is usefulforfor extensions that need to build dependency graphsfromfrom arbitrary methods. @param method any single method present on {@code type}. @param type the concrete type that defines {@code method}.@since 4.0
Returns all static method and field injection points on {@code type}. @return a possibly empty set of injection points. The set has a specified iteration order. AllClass InjectionPoint, Set<InjectionPoint> forStaticMethodsAndFields(TypeLiteral<?>)fields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods. @throws ConfigurationException if there is a malformed injection point on {@code type}, such asa field with multiple binding annotations. The exception's partial value is a {@code Set} ofofthe valid injection points.
Returns all static method and field injection points on {@code type}. @return a possibly empty set of injection points. The set has a specified iteration order. AllClass InjectionPoint, TypeLiteral<?> getDeclaringType()fields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods. @throws ConfigurationException if there is a malformed injection point on {@code type}, such asa field with multiple binding annotations. The exception's partial value is a {@code Set} ofofthe valid injection points.
Returns the generic type that defines this injection point. If the member exists on a parameterized type, the result will include more type information than the member's raw declaring class.Class InjectionPoint, boolean isToolable()@since 3.0
Returns true if the element is annotated with {@literal @}Toolable.@since 3.0
A request to inject the instance fields and methods of an instance. Requests are created explicitly in a module using requestInjection() statements:Class InjectionRequest, Set<InjectionPoint> getInjectionPoints()requestInjection(serviceInstance);@author mikeward@google.com (Mike Ward) @since 2.0
Returns the instance methods and fields of {@code instance} that will be injected to fulfill this request. @return a possibly empty set of injection points. The set has a specified iteration order. Allfields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods. @throws ConfigurationException if there is a malformed injection point on the class of {@codeinstance}, such as a field with multiple binding annotations. The exception's partial value is a {@code Set} ofofthe valid injection points.
Registration of interceptors for matching methods of matching classes. Instances are created explicitly in a module using bindInterceptor() statements:bindInterceptor(Matchers.subclassesOf(MyAction.class), Matchers.annotatedWith(Transactional.class), new MyTransactionInterceptor());or from an injectable type listener using TypeEncounter.bindInterceptor(). @author jessewilson@google.com (Jesse Wilson) @since 2.0
A lookup of the members injector for a type. Lookups are created explicitly in a module using getMembersInjector() statements:Class MembersInjectorLookup, MembersInjector<T> getDelegate()MembersInjector<PaymentService> membersInjector = getMembersInjector(PaymentService.class);@author crazybob@google.com (Bob Lee) @since 2.0
Returns the delegate members injector, or {@code null} if it has not yet been initialized.TheThe delegate will be initialized when this element is processed, or otherwise used tocreatecreateanan injector.
An error message and the context in which it occured. Messages are usually created internally by Guice and its extensions. Messages can be created explicitly in a module using addError() statements:Class Message, Throwable getCause()try { bindPropertiesFromFile(); } catch (IOException e) { addError(e); }@author crazybob@google.com (Bob Lee)
Returns the throwable that caused this message, or {@code null} ifthisthis message was notcausedcaused by a throwable. @since 2.0
Allows extensions to scan modules for annotated methods and bind thoseClass ModuleAnnotatedMethodScanner, Key<T> prepareMethod(Binder, Annotation, Key<T>, InjectionPoint)methodsmethods as providers, similar to {@code @Provides} methods. @since 4.0
Prepares a method for binding. This {@code key} parameter is the key discovered from looking at the binding annotation and return value of the method. Implementations can modify the key to instead bind to another key. For example, Multibinder may want tochangechange {@code @SetProvidesSetProvides String provideFoo()} to bind into a unique Key within themultibindermultibinder instead of binding {@codecode String}.The injection point and annotation are provided in case the implementation wants to set the key based on the property of the annotation or if any additional preparation is needed for any of the dependencies. The annotation is guaranteed to be an instance of one the classes returned by .annotationClasses.
Represents a call to Binder.scanModulesForAnnotatedMethods in a module.@author sameb@google.com (Sam Berlin) @since 4.0
If the user supplied a JSR330 binding, then this will wrap that one. To always return the user-supplied provider, use .getUserSuppliedProvider.Class ProviderInstanceBinding, Provider<? extends T> getUserSuppliedProvider()@deprecated Use .getUserSuppliedProvider instead.
Returns the user-supplied, unscoped provider.@since 4.0
A lookup of the provider for a type. Lookups are created explicitly in a moduleusingusing getProvider() statements:Provider<PaymentService> paymentServiceProvider = getProvider(PaymentService.class);@author jessewilson@google.com (Jesse Wilson) @since 2.0
A Provider that is part of an extension which supports aClass ProviderWithExtensionVisitor, V acceptExtensionVisitor(BindingTargetVisitor<B, V>, ProviderInstanceBinding<? extends B>)customcustom BindingTargetVisitor.
When an extension binds a provider instance, the provider can implementthisthis interfacetoto allow users usingthethe Binding.acceptTargetVisitor(BindingTargetVisitor) method to visit a custom visitor designed for that extension. A typical implementationwithinwithin the extensionwouldwould looklikelike<V, B> V acceptExtensionVisitor(BindingTargetVisitor<B, V> visitor, ProviderInstanceBinding<? extends B> binding) { if(visitor instanceof MyCustomExtensionVisitor) { return ((MyCustomExtensionVisitor<B, V>)visitor).visitCustomExtension(customProperties, binding); } else { return visitor.visit(binding); } }'MyCustomExtensionVisitor' in the example above would be an interfacethethe extension providesthatthat users can implement in order to be notified ofcustomcustom extension information. Thesevisitorvisitor interfaces must extendfromfrom BindingTargetVisitor. @since 3.0 @author sameb@google.com (Sam Berlin)
Instructs the extension determine if the visitor is an instance of acustomcustom extension visitor, and if so, visit it using that method. If the visitorisis not an instance of thecustomcustom extension visitor, this method MUSTcall visitor.visit(binding).
Due to issues with generics, the type parameters of this method donotnot relate to the typeofof the provider. In practice, the 'B' type willalwaysalways be a supertype of 'T'.
An {@literal @}Provides binding or binding produced byClass ProvidesMethodBinding, Annotation getAnnotation()aa ModuleAnnotatedMethodScanner. @since 4.0 @author sameb@google.com (Sam Berlin)
Returns the annotation that caused this binding to be created. For {@code @Provides} methods, this is an instance of the {@code @Provides} annotation. For bindingsfromfrom ModuleAnnotatedMethodScanner, this is the annotation that caused the scanner toproduceproducethethe binding.
A visitor for the {@literal @}Provides bindings.
If your com.google.inject.spi.BindingTargetVisitor implements this interface,bindingsbindings created byusingusing {@code @Provides} will be visited through this interface. @since 4.0 @author sameb@google.com (Sam Berlin)
Listens for provisioning of objects. Useful for gathering timinginformationinformation about provisioning, post-provision initialization, and more.@author sameb@google.com (Sam Berlin) @since 4.0
Returns the Binding this is provisioning.Class ProvisionListener.ProvisionInvocation, List<DependencyAndSource> getDependencyChain()
You must not call Provider.get() on the provider returnedbyby Binding.getProvider, otherwise you will get confusing error messages.
Returns the dependency chain that led to this object being provisioned. @deprecated This method is planned for removal in Guice 4.4. Some use cases can be replaced by inferring the current chain via ThreadLocals in the listener, other use cases can use the static dependency graph. For example,{@code bindListener(Matchers.any(), new MyListener()); ... private static final class MyListener implements ProvisionListener { private final ThreadLocal>> bindingStack = new ThreadLocal >>() { {@literal @}Override protected ArrayDeque > initialValue() { return new ArrayDeque<(); } }; {@literal @}Override public void onProvision(ProvisionInvocation invocation) { bindingStack.get().push(invocation.getBinding()); try { invocation.provision(); } finally { bindingStack.get().pop(); } // Inspect the binding stack... } } } In this example the bindingStack thread local will contain a data structure that is very similar to the data returned by this list. The main differences are that linked keys are not in the stack, but such edges do exist in the static dependency graph (inspectable via HasDependencies.getDependencies()), so you could infer some of the missing edges..
Invoked by Guice when an object requires provisioning. Provisioningoccursoccurs when Guicelocateslocates and injects the dependencies for a binding. Fortypestypes bound to a Provider,provisioningprovisioning encapsulates the Provider.getmethod. For toInstance or constant bindings,provisioning encapsulatesprovisioning encapsulates the injecting of {@literal @}{@code Inject}ed fields or methods.For other types, provisioning encapsulates the construction ofthethe object. If a type is bound within a Scope, provisioning dependsonon the scope. Types bound in Singleton scope will onlybebe provisioned once.Types bound in no scope will be provisioned every time they are injected. Other scopes define their own behavior for provisioning.
To perform the provision, call ProvisionInvocation.provision().If you donotnot explicitly call provision, it will be automatically doneafterafter this method returns.It isanan error to call provision more than once.
Registration of a scope annotation with the scope that implements it. Instances are created explicitly in a module using bindScope() statements:Scope recordScope = new RecordScope(); bindScope(RecordScoped.class, new RecordScope());@author jessewilson@google.com (Jesse Wilson) @since 2.0
A request to inject the static fields and methods of a type. Requests areClass StaticInjectionRequest, Set<InjectionPoint> getInjectionPoints()createdcreated explicitly inaa module using requestStaticInjection() statements:requestStaticInjection(MyLegacyService.class);@author jessewilson@google.com (Jesse Wilson) @since 2.0
Returns the static methods and fields of {@code type} that will be injected to fulfill this request. @return a possibly empty set of injection points. The set has a specified iteration order. Allfields are returned and then all methods. Within the fields, supertype fields are returnedbefore subtype fields. Similarly, supertype methods are returned before subtype methods. @throws ConfigurationException if there is a malformed injection point on {@code type}, such asa field with multiple binding annotations. The exception's partial value is a {@code Set} ofofthe valid injection points.
Instructs an Injector running in Stage.TOOL that a method should be injected. This is typically useful for for extensions to Guice that perform additional validation in an injected method or field.This only applies to objects that are already constructedwhen bindingswhen bindings are created (ie., something bound using toProvider, toInstance, or requestInjection.@author sberlin@gmail.com (Sam Berlin) @since 3.0
Registration of type converters for matching target types. Instances arecreatedcreated explicitly inaa module using convertToTypes() statements:convertToTypes(Matchers.only(TypeLiteral.get(DateTime.class)), new DateTimeConverter());
@author jessewilson@google.com (Jesse Wilson) @since 2.0
Context of an injectable type encounter. Enables reporting errors, registering injection listeners and binding method interceptors for injectable type {@code I}. It is an error toClass TypeEncounter, void addError(String, Object[])use anuse an encounter after the hear() method has returned. @param the injectable type encountered @since 2.0
Records an error message for type {@code I} which will be presented to the user at a later time. Unlike throwing an exception, this enable us to continue configuring the Injector and discover more errors. Uses String.format(String, Object[]) to insert theClass TypeEncounter, void bindInterceptor(Matcher<Method>, MethodInterceptor[])arguments intoarguments into the message.
Binds method interceptor[s] to methods matched in type {@code I} and its supertypes.Class TypeEncounter, MembersInjector<T> getMembersInjector(Class<T>)A methodA method is eligible for interception if:@param methodMatcher matches methods the interceptor should apply to.
- Guice created the instance the method is
onon- Neither the enclosing type nor the method is
finalfinal- And the method is package-private or more
accessibleaccessibleForForexample: {@codecode annotatedWith(Transactional.class)}. @param interceptors to bind
Returns the members injector used to inject dependencies into methods and fields on instances of the given type {@code T}. The returned members injector will not be valid until the main injector has been created. The members injector will throw an {@code IllegalStateException}Class TypeEncounter, MembersInjector<T> getMembersInjector(TypeLiteral<T>)ifif you try to use it beforehand. @param type type to get members injector for
Returns the members injector used to inject dependencies into methods and fields on instances of the given type {@code T}. The returned members injector will not be valid until the main injector has been created. The members injector will throw an {@code IllegalStateException}ifif you try to use it beforehand. @param typeLiteral type to get members injector for
Listens for Guice to encounter injectable types. If a given type has its constructor injected in one situation but only its methods and fields injected in another, Guice will notify this listener once.Class TypeListener, void hear(TypeLiteral<I>, TypeEncounter<I>)Useful for extra type checking, TypeEncounter#register(InjectionListener) registering injection listeners, and TypeEncounter#bindInterceptor( com.google.inject.matcher.Matcher, org.aopalliance.intercept.MethodInterceptor[])
bindingmethodmethod interceptors.@since 2.0
Invoked when Guice encounters a new type eligible for constructor or members injection.CalledCalled during injector creation (or afterwards if Guice encounters a type at run timeandand createsaa JIT binding). @param type encountered by Guice @param encounter context of this encounter, enables reporting errors, registering injection listeners and binding method interceptors for {@code type}.@param the injectable type