Class AbstractGenericHintFactory<T>

    • Constructor Detail

      • AbstractGenericHintFactory

        protected AbstractGenericHintFactory()
        Place to register default configurations.
    • Method Detail

      • hasMapping

        protected boolean hasMapping​(RegistrationKey key)
        Parameters:
        key - the key associated with the implementation class
        Returns:
        true if the mapping is already registered or false otherwise
      • getMapping

        protected Class<? extends T> getMapping​(RegistrationKey key)
        Parameters:
        key - the key associated with the implementation class to return
        Returns:
        the implementation class
      • registerImplementation

        protected void registerImplementation​(RegistrationKey key,
                                              Class<? extends T> implementationClass)
        Register an implementation class for a given key.
        Parameters:
        key - the key under which to register the implementation class
        implementationClass - the implementation class to register
      • createImplementation

        protected T createImplementation​(RegistrationKey key,
                                         AbstractGenericHintFactory.GenericParameters parameters,
                                         String implementationConceptName)
        Generic method to create an implementation based on the registered implementation classes.
        Parameters:
        key - the key under which the implementation class is registered
        parameters - the additional parameters necessary to create the constructor object
        implementationConceptName - the name of what the implementation class is representing. This is used in exception text messages to provide message customization. For example "container", "configuration", "deployable', etc.
        Returns:
        the created instance
      • getConstructor

        protected abstract Constructor<? extends T> getConstructor​(Class<? extends T> implementationClass,
                                                                   String hint,
                                                                   AbstractGenericHintFactory.GenericParameters parameters)
                                                            throws NoSuchMethodException
        Create a constructor.
        Parameters:
        implementationClass - implementation class for which to create the constructor
        hint - the hint to differentiate this implementation class from others
        parameters - additional parameters necessary to create the constructor object
        Returns:
        the constructor to use for creating an instance
        Throws:
        NoSuchMethodException - in case of error
      • createInstance

        protected abstract T createInstance​(Constructor<? extends T> constructor,
                                            String hint,
                                            AbstractGenericHintFactory.GenericParameters parameters)
                                     throws Exception
        Create an implementation class instance.
        Parameters:
        constructor - the constructor to use for creating the instance
        hint - the hint to differentiate this implementation class from others
        parameters - additional parameters necessary to create the instance
        Returns:
        the created instance
        Throws:
        Exception - in case of error