Class 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.

    • 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 given foreign 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()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NOOP_DISPOSE_INSTANCE

        private static final java.util.function.Consumer<java.lang.Object> NOOP_DISPOSE_INSTANCE
      • foreignDescriptor

        private final java.lang.Object foreignDescriptor
      • disposeInstance

        private final java.util.function.Consumer<java.lang.Object> disposeInstance
    • 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 given foreign 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 interface ForeignDescriptor
        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 interface ForeignDescriptor
        Parameters:
        instance - The instance to destroy.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object