Class ReflectionNode<T>

  • Type Parameters:
    T - is the type of the instance this node refers to
    All Implemented Interfaces:
    jakarta.inject.Provider<T>, java.io.Closeable, java.lang.AutoCloseable, java.util.function.Supplier<T>
    Direct Known Subclasses:
    ConstructsNew, ProvidesNew

    public abstract class ReflectionNode<T>
    extends Node<T>
    Defines a baseline structure for the dependency graph nodes which can produce new object instances.
    • Constructor Detail

      • ReflectionNode

        protected ReflectionNode​(InjectorReference injectorReference,
                                 java.util.List<ParameterInformation> parametersInformation,
                                 java.util.List<FieldInformation> fieldsInformation,
                                 Key<?>... extraParentKeys)
        Default constructor.
        Parameters:
        injectorReference - for dependency lookups
        parametersInformation - of the method to be invoked during dependency injection
        fieldsInformation - of the class to be set during dependency injection
        extraParentKeys - this node depends upon
    • Method Detail

      • fieldsInformation

        public java.util.List<FieldInformation> fieldsInformation()
      • createArguments

        protected java.lang.Object[] createArguments()
        Create an array of arguments for instantiation method invocation.
        Returns:
        an array of objects to serve as method arguments
      • injectFields

        protected T injectFields​(T instance)
                          throws java.lang.IllegalAccessException
        Perform in-place field injection into an object instance.
        Parameters:
        instance - to inject fields into
        Returns:
        an original object instance with injected fields
        Throws:
        java.lang.IllegalAccessException - if we cannot access the field to inject the value into
      • equals

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

        public int hashCode()
        Overrides:
        hashCode in class Node<T>
      • isNotSupportedWrapperClass

        public static boolean isNotSupportedWrapperClass​(java.lang.Class<?> clazz)
        Checks if current Class is either Provider or Supplier.
        Parameters:
        clazz - to check
        Returns:
        true, if the Class is either Provider or Supplier