Interface ForeignDescriptor
- All Known Implementing Classes:
ForeignDescriptorImpl
public interface ForeignDescriptor
The descriptor holder for an externally provided DI providers. Using this interface DI provider is able to provider his own
descriptor which can be used and returned to the DI provider in further processing.
This is useful in the case of caching where an algorithm is able to store and subsequently provide for an injection the already resolved descriptor of the same value.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Disposes this instance.get()
Returns an object that can be cast on the side of DI provider to his descriptor.static ForeignDescriptor
Wraps incoming descriptor instance and provides a default implementation ofForeignDescriptor
.static ForeignDescriptor
Wraps incoming descriptor instance and provides a default implementation ofForeignDescriptor
along with aConsumer
for a disposing an instance created using a given descriptor.
-
Method Details
-
get
Object get()Returns an object that can be cast on the side of DI provider to his descriptor.- Returns:
- DI provider's descriptor.
-
dispose
Disposes this instance. All the PerLookup objects that were created for this instance will be destroyed after this object has been destroyed.- Parameters:
instance
- The instance to destroy.
-
wrap
Wraps incoming descriptor instance and provides a default implementation ofForeignDescriptor
.- Parameters:
descriptor
- incoming foreign descriptor.- Returns:
- wrapped foreign descriptor.
-
wrap
Wraps incoming descriptor instance and provides a default implementation ofForeignDescriptor
along with aConsumer
for a disposing an instance created using a given descriptor.- Parameters:
descriptor
- incoming foreign descriptor.disposeInstance
- consumer which is able to dispose an instance created with the given descriptor.- Returns:
- wrapped foreign descriptor.
-