Class ForeignDescriptorImpl
- java.lang.Object
-
- org.glassfish.jersey.internal.inject.ForeignDescriptorImpl
-
- All Implemented Interfaces:
ForeignDescriptor
public class ForeignDescriptorImpl extends java.lang.Object implements 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.
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor 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 givenforeign key
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
-
-
-
Constructor Detail
-
ForeignDescriptorImpl
public ForeignDescriptorImpl(java.lang.Object foreignDescriptor)
Constructor accepts a descriptor of the DI provider and to be able to provide it in further processing.- Parameters:
foreignDescriptor
- DI provider's descriptor.
-
ForeignDescriptorImpl
public 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 givenforeign key
.- Parameters:
foreignDescriptor
- DI provider's descriptor.
-
-
Method Detail
-
get
public java.lang.Object get()
Description copied from interface:ForeignDescriptor
Returns an object that can be cast on the side of DI provider to his descriptor.- Specified by:
get
in interfaceForeignDescriptor
- Returns:
- DI provider's descriptor.
-
dispose
public void dispose(java.lang.Object instance)
Description copied from interface:ForeignDescriptor
Disposes this instance. All the PerLookup objects that were created for this instance will be destroyed after this object has been destroyed.- Specified by:
dispose
in interfaceForeignDescriptor
- Parameters:
instance
- The instance to destroy.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-