public class ForeignDescriptorImpl extends java.lang.Object implements 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 | Field and Description |
---|---|
private java.util.function.Consumer<java.lang.Object> |
disposeInstance |
private java.lang.Object |
foreignDescriptor |
private static java.util.function.Consumer<java.lang.Object> |
NOOP_DISPOSE_INSTANCE |
Constructor and Description |
---|
ForeignDescriptorImpl(java.lang.Object foreignDescriptor)
Constructor accepts a descriptor of the DI provider and to be able to provide it in further processing.
|
ForeignDescriptorImpl(java.lang.Object foreignDescriptor,
java.util.function.Consumer<java.lang.Object> disposeInstance)
Constructor accepts a descriptor of the DI provider and to be able to provide it in further processing along with
dispose mechanism to destroy the objects corresponding the given
foreign key . |
Modifier and Type | Method and Description |
---|---|
void |
dispose(java.lang.Object instance)
Disposes this instance.
|
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get()
Returns an object that can be cast on the side of DI provider to his descriptor.
|
int |
hashCode() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
wrap, wrap
private static final java.util.function.Consumer<java.lang.Object> NOOP_DISPOSE_INSTANCE
private final java.lang.Object foreignDescriptor
private final java.util.function.Consumer<java.lang.Object> disposeInstance
public ForeignDescriptorImpl(java.lang.Object foreignDescriptor)
foreignDescriptor
- DI provider's descriptor.public ForeignDescriptorImpl(java.lang.Object foreignDescriptor, java.util.function.Consumer<java.lang.Object> disposeInstance)
foreign key
.foreignDescriptor
- DI provider's descriptor.public java.lang.Object get()
ForeignDescriptor
get
in interface ForeignDescriptor
public void dispose(java.lang.Object instance)
ForeignDescriptor
dispose
in interface ForeignDescriptor
instance
- The instance to destroy.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object