Interface FactoryMethod

    • Method Detail

      • constructor

        static Function<Class<?>,​FactoryMethod> constructor​(Injectable... params)
        Creates a FactoryMethod representing a constructor. The constructor must be public, and the type of the provided injectables must match strictly the signature of the constructor.
        Parameters:
        params - describes what to inject in the constructor parameters
        Returns:
        a new FactoryMethod
        Throws:
        RdiException - if the constructor is not public, does not exist or has a signature that doesn't match with the given injectable parameters.
      • staticFactory

        static Function<Class<?>,​FactoryMethod> staticFactory​(String methodName,
                                                                    Class<?> returnType,
                                                                    Injectable... params)
        Creates a FactoryMethod representing a static factory method. The method must be public, and the name, return type, and type of the provided injectables must match strictly the signature of the method.

        This assumes that the static factory is located in the same class as the service to instantiate. If it isn't the case, use externalStaticFactory(Class, String, Class, Injectable...) instead.

        Parameters:
        methodName - the name of the method
        returnType - the return type of the method
        params - describes what to inject in the method parameters
        Returns:
        a new FactoryMethod
        Throws:
        RdiException - if the method is not public, does not exist or has a signature that doesn't match with the given injectable parameters.
      • externalStaticFactory

        static Function<Class<?>,​FactoryMethod> externalStaticFactory​(Class<?> owner,
                                                                            String methodName,
                                                                            Class<?> returnType,
                                                                            Injectable... params)
        Creates a FactoryMethod representing a static factory method. The method must be public, and the name, return type, and type of the provided injectables must match strictly the signature of the method.

        If the static factory method is located in the same class as the service to instantiate, you may prefer using staticFactory(String, Class, Injectable...) which doesn't require you to specify the owner.

        Parameters:
        owner - the class that owns the target factory method
        methodName - the name of the method
        returnType - the return type of the method
        params - describes what to inject in the method parameters
        Returns:
        a new FactoryMethod
        Throws:
        RdiException - if the method is not public, does not exist or has a signature that doesn't match with the given injectable parameters.
      • invoke

        reactor.core.publisher.Mono<Object> invoke​(Object... args)