Class ForeignDescriptorImpl

java.lang.Object
org.glassfish.jersey.internal.inject.ForeignDescriptorImpl
All Implemented Interfaces:
ForeignDescriptor

public class ForeignDescriptorImpl extends 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 Details

    • NOOP_DISPOSE_INSTANCE

      private static final Consumer<Object> NOOP_DISPOSE_INSTANCE
    • foreignDescriptor

      private final Object foreignDescriptor
    • disposeInstance

      private final Consumer<Object> disposeInstance
  • Constructor Details

    • ForeignDescriptorImpl

      public ForeignDescriptorImpl(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(Object foreignDescriptor, Consumer<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.
      Parameters:
      foreignDescriptor - DI provider's descriptor.
  • Method Details

    • get

      public 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 interface ForeignDescriptor
      Returns:
      DI provider's descriptor.
    • dispose

      public void dispose(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 interface ForeignDescriptor
      Parameters:
      instance - The instance to destroy.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object