public interface ForeignDescriptor
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.
Modifier and Type | Method and Description |
---|---|
void |
dispose(Object instance)
Disposes this instance.
|
Object |
get()
Returns an object that can be cast on the side of DI provider to his descriptor.
|
static ForeignDescriptor |
wrap(Object descriptor)
Wraps incoming descriptor instance and provides a default implementation of
ForeignDescriptor . |
static ForeignDescriptor |
wrap(Object descriptor,
Consumer<Object> disposeInstance)
Wraps incoming descriptor instance and provides a default implementation of
ForeignDescriptor along with a
Consumer for a disposing an instance created using a given descriptor. |
Object get()
void dispose(Object instance)
instance
- The instance to destroy.static ForeignDescriptor wrap(Object descriptor)
ForeignDescriptor
.descriptor
- incoming foreign descriptor.static ForeignDescriptor wrap(Object descriptor, Consumer<Object> disposeInstance)
ForeignDescriptor
along with a
Consumer
for a disposing an instance created using a given descriptor.descriptor
- incoming foreign descriptor.disposeInstance
- consumer which is able to dispose an instance created with the given descriptor.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.