Class AliasDescriptor<T>

  • Type Parameters:
    T - The cache type
    All Implemented Interfaces:
    Externalizable, Serializable, ActiveDescriptor<T>, Descriptor, SingleCache<T>

    public class AliasDescriptor<T>
    extends AbstractActiveDescriptor<T>
    An active descriptor class that serves as an alias for another descriptor. This alias can have only one contract that may or may not also be advertised by the host descriptor. An AliasDescriptor can have a different name from the host descriptor as well
    Author:
    tbeerbower
    See Also:
    Serialized Form
    • Field Detail

      • ALIAS_METADATA_MARKER

        public static final String ALIAS_METADATA_MARKER
        This will be put in all Alias descriptors. The value will be ALIAS_FREE_DESCRIPTOR if the descritpor being aliased does not have a locator and service id. If the descriptor being aliased does have a locator and service id the value will be .
        See Also:
        Constant Field Values
      • ALIAS_FREE_DESCRIPTOR

        public static final String ALIAS_FREE_DESCRIPTOR
        This is the value the metadata field ALIAS_METADATA_MARKER will take if the descriptor being aliased does not have a locator id or a service id
        See Also:
        Constant Field Values
    • Constructor Detail

      • AliasDescriptor

        public AliasDescriptor()
        For serialization
      • AliasDescriptor

        public AliasDescriptor​(ServiceLocator locator,
                               ActiveDescriptor<T> descriptor,
                               String contract,
                               String name)
        Construct an AliasDescriptor.
        Parameters:
        locator - the service locator
        descriptor - the descriptor to be aliased
        contract - the contact
        name - the name
    • Method Detail

      • getImplementationClass

        public Class<?> getImplementationClass()
        Description copied from interface: ActiveDescriptor
        The implementation class that should be used to generate new instances of this descriptor.

        If the class returned is a Factory, then the factory is used to create instances. In this case the system will get an instance of the factory and use it to create the instances

        Returns:
        The class that directly implements the contract types, or the class that is the factory for an object that implements the contract types
      • create

        public T create​(ServiceHandle<?> root)
        Description copied from interface: ActiveDescriptor
        Creates an instance of the ActiveDescriptor. All of the Injectee's must be created prior to instantiation, and associated with the ExtendedProvider so that they can be destroyed properly
        Parameters:
        root - The root service handle, which can be used to associated all the PerLookup objects with this creation
        Returns:
        An instance of this ActiveDescriptor
      • isReified

        public boolean isReified()
        Description copied from interface: ActiveDescriptor
        This method returns true if this descriptor has been reified (class loaded). If this method returns false then the other methods in this interface will throw an IllegalStateException. Once this method returns true it may be
        Specified by:
        isReified in interface ActiveDescriptor<T>
        Overrides:
        isReified in class AbstractActiveDescriptor<T>
        Returns:
        true if this descriptor has been reified, false otherwise
      • getImplementation

        public String getImplementation()
        Description copied from interface: Descriptor
        Returns the fully qualified class name of the implementation class. If this is a factory descriptor then this will return the fully qualified name of the class implementing the factory interface.
        Specified by:
        getImplementation in interface Descriptor
        Overrides:
        getImplementation in class DescriptorImpl
        Returns:
        Might return null in some cases, but will usually return the fully qualified class name of the implementation class or of the factory class for this descriptor
      • getQualifiers

        public Set<String> getQualifiers()
        Description copied from interface: Descriptor
        Returns all of the annotation classes that this object should be registered with or looked up by
        Specified by:
        getQualifiers in interface Descriptor
        Overrides:
        getQualifiers in class DescriptorImpl
        Returns:
        Never returns null, but may return an empty set. The set of fully qualified class names that are annotations that this object must have
      • getInjectees

        public List<Injectee> getInjectees()
        Description copied from interface: ActiveDescriptor
        Returns the full list of Injectees this class has. These references will be resolved prior to the class being constructed, even if these injectees are field or method injectees.

        If this descriptor is describing a factory created type then this list must have zero length

        Specified by:
        getInjectees in interface ActiveDescriptor<T>
        Overrides:
        getInjectees in class AbstractActiveDescriptor<T>
        Returns:
        Will not return null, but may return an empty list. The set of Injectees that must be resolved before this ActiveDescriptor can be constructed
      • dispose

        public void dispose​(T instance)
        Description copied from interface: ActiveDescriptor
        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 ActiveDescriptor<T>
        Overrides:
        dispose in class AbstractActiveDescriptor<T>
        Parameters:
        instance - The instance to destroy
      • getDescriptor

        public ActiveDescriptor<T> getDescriptor()
        Get the descriptor being aliased.
        Returns:
        the descriptor
      • equals

        public boolean equals​(Object o)
        Description copied from class: DescriptorImpl
        This equals matches only if the following fields of the descriptor match:
        • implementation
        • contracts
        • name
        • scope
        • qualifiers
        • descriptorType
        • descriptorVisibility
        • metadata
        • proxiable
        • proxyForSameScope
        • analysisName
        Overrides:
        equals in class AbstractActiveDescriptor<T>
        Parameters:
        o - The object to compare to this one. May be null (which will result in a false)
        Returns:
        true if the descriptors are equal