Class InstanceImpl<T>

    • Method Detail

      • get

        public T get()
        Description copied from interface: Provider
        Provides a fully-constructed and injected instance of T.
        Specified by:
        get in interface Provider<T>
        Returns:
        instance of T.
      • toString

        public String toString()
        Gets a string representation
        Overrides:
        toString in class Object
        Returns:
        A string representation
      • isAmbiguous

        public boolean isAmbiguous()
        Description copied from interface: Instance

        Determines if there is more than one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent Instance was injected.

        Specified by:
        isAmbiguous in interface Instance<T>
        Returns:
        true if there is more than one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent Instance was injected, or false otherwise.
      • isUnsatisfied

        public boolean isUnsatisfied()
        Description copied from interface: Instance

        Determines if there is no bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent Instance was injected.

        Specified by:
        isUnsatisfied in interface Instance<T>
        Returns:
        true if there is no bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent Instance was injected, or false otherwise.
      • select

        public WeldInstance<T> select​(Annotation... qualifiers)
        Description copied from interface: Instance

        Obtains a child Instance for the given additional required qualifiers.

        Specified by:
        select in interface Instance<T>
        Specified by:
        select in interface WeldInstance<T>
        Parameters:
        qualifiers - the additional required qualifiers
        Returns:
        the child Instance
      • select

        public <U extends TWeldInstance<U> select​(Class<U> subtype,
                                                    Annotation... qualifiers)
        Description copied from interface: Instance

        Obtains a child Instance for the given required type and additional required qualifiers.

        Specified by:
        select in interface Instance<T>
        Specified by:
        select in interface WeldInstance<T>
        Type Parameters:
        U - the required type
        Parameters:
        subtype - a Class representing the required type
        qualifiers - the additional required qualifiers
        Returns:
        the child Instance
      • select

        public <U extends TWeldInstance<U> select​(TypeLiteral<U> subtype,
                                                    Annotation... qualifiers)
        Description copied from interface: Instance

        Obtains a child Instance for the given required type and additional required qualifiers.

        Specified by:
        select in interface Instance<T>
        Specified by:
        select in interface WeldInstance<T>
        Type Parameters:
        U - the required type
        Parameters:
        subtype - a TypeLiteral representing the required type
        qualifiers - the additional required qualifiers
        Returns:
        the child Instance
      • select

        public <X> WeldInstance<X> select​(Type subtype,
                                          Annotation... qualifiers)
        Description copied from interface: WeldInstance

        Obtains a child Instance for the given required type and additional required qualifiers. Must be invoked on Instance<T> where T is Object.

        Specified by:
        select in interface WeldInstance<T>
        Type Parameters:
        X - the required type
        Parameters:
        subtype - a Type representing the required type
        qualifiers - the additional required qualifiers
        Returns:
        the child Instance
      • destroy

        public void destroy​(T instance)
        Description copied from interface: Instance

        When called, the container destroys the instance if the active context object for the scope type of the bean supports destroying bean instances. All normal scoped built-in contexts support destroying bean instances.

        The instance passed should either be a dependent scoped bean instance obtained from the same Instance object, or the client proxy for a normal scoped bean instance.

        Specified by:
        destroy in interface Instance<T>
        Parameters:
        instance - the instance to destroy
      • getHandle

        public Instance.Handle<T> getHandle()
        Description copied from interface: Instance
        Obtains an initialized contextual reference handle for a bean that has the required type and qualifiers and is eligible for injection. Throws exceptions if there is no such bean or more than one.

        The contextual reference is obtained lazily, i.e. when first needed.

        Specified by:
        getHandle in interface Instance<T>
        Returns:
        a new Instance.Handle instnace
      • getHandler

        public WeldInstance.Handler<T> getHandler()
        Description copied from interface: WeldInstance
        This method is deprecated as a similar functioning method exists in CDI 4.0 and newer. Users should instead use Instance.getHandle(). Obtains an initialized contextual reference handler for the bean that has the required type and required qualifiers and is eligible for injection.

        The contextual reference is obtained lazily, i.e. when first needed.

        Specified by:
        getHandler in interface WeldInstance<T>
        Returns:
        a new handler
      • isResolvable

        public boolean isResolvable()
        Description copied from interface: Instance

        Determines if there is exactly one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent Instance was injected.

        Specified by:
        isResolvable in interface Instance<T>
        Returns:
        true if there is exactly one bean that matches the required type and qualifiers and is eligible for injection into the class into which the parent Instance was injected, or false otherwise.
      • handles

        public Iterable<Instance.Handle<T>> handles()
        Description copied from interface: Instance
        Allows iterating over contextual reference handles for all beans that have the required type and required qualifiers and are eligible for injection.

        Note that the returned Iterable is stateless. Therefore, each Iterable.iterator() produces a new set of handles.

        Specified by:
        handles in interface Instance<T>
        Returns:
        a new iterable
      • handlers

        public Iterable<WeldInstance.Handler<T>> handlers()
        Description copied from interface: WeldInstance
        This method is deprecated as a similar functioning method exists in CDI 4.0 and newer. Users should instead use Instance.handles(). Allows to iterate over contextual reference handlers for all the beans that have the required type and required qualifiers and are eligible for injection.

        Note that the returned Iterable is stateless and so each Iterable.iterator() produces a new set of handlers.

        Specified by:
        handlers in interface WeldInstance<T>
        Returns:
        a new iterable
      • getHandlePriorityComparator

        public Comparator<Instance.Handle<?>> getHandlePriorityComparator()
        Description copied from interface: WeldInstance
        The returned comparator sorts handles by priority in descending order.
        • A class-based bean whose annotated type has jakarta.annotation.Priority has the priority of value jakarta.annotation.Priority#value()
        • A custom bean which implements Prioritized has the priority of value Prioritized.getPriority()
        • Any other bean has the priority of value 0
        Specified by:
        getHandlePriorityComparator in interface WeldInstance<T>
        Returns:
        a comparator instance