IT. Expert System.

Java Enterprise Edition (EE)

Provider


javax.inject
Interface Provider<T>

All Known Subinterfaces:
Instance<T>
public interface Provider<T>

Provides instances of T. Typically implemented by an injector. For any type T that can be injected, you can also inject Provider<T>. Compared to injecting T directly, injecting Provider<T> enables:

  • retrieving multiple instances.
  • lazy or optional retrieval of an instance.
  • breaking circular dependencies.
  • abstracting scope so you can look up an instance in a smaller scope from an instance in a containing scope.

For example:

   class Car {
     @Inject Car(Provider<Seat> seatProvider) {
       Seat driver = seatProvider.get();
       Seat passenger = seatProvider.get();
       ...
     }
   }

Method Summary
 T get()
          Provides a fully-constructed and injected instance of T.
 

Method Detail

get

T get()
Provides a fully-constructed and injected instance of T.

Throws:
java.lang.RuntimeException - if the injector encounters an error while providing an instance. For example, if an injectable member on T throws an exception, the injector may wrap the exception and throw it to the caller of get(). Callers should not try to handle such exceptions as the behavior may vary across injector implementations and even different configurations of the same injector.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 14312 / . Delta: 0.01191 с