org.springframework.boot.util

Class Instantiator<T>

  • java.lang.Object
    • org.springframework.boot.util.Instantiator<T>
  • Type Parameters:
    T - the type to instantiate


    public class Instantiator<T>
    extends java.lang.Object
    Simple factory used to instantiate objects by injecting available parameters.
    Since:
    2.4.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.util.List<T> instantiate(java.lang.ClassLoader classLoader, java.util.Collection<java.lang.String> names)
      Instantiate the given set of class name, injecting constructor arguments as necessary.
      java.util.List<T> instantiate(java.util.Collection<java.lang.String> names)
      Instantiate the given set of class name, injecting constructor arguments as necessary.
      java.util.List<T> instantiateTypes(java.util.Collection<java.lang.Class<?>> types)
      Instantiate the given set of classes, injecting constructor arguments as necessary.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Instantiator

        public Instantiator(java.lang.Class<?> type,
                            java.util.function.Consumer<Instantiator.AvailableParameters> availableParameters)
        Create a new Instantiator instance for the given type.
        Parameters:
        type - the type to instantiate
        availableParameters - consumer used to register available parameters
    • Method Detail

      • instantiate

        public java.util.List<T> instantiate(java.util.Collection<java.lang.String> names)
        Instantiate the given set of class name, injecting constructor arguments as necessary.
        Parameters:
        names - the class names to instantiate
        Returns:
        a list of instantiated instances
      • instantiate

        public java.util.List<T> instantiate(java.lang.ClassLoader classLoader,
                                             java.util.Collection<java.lang.String> names)
        Instantiate the given set of class name, injecting constructor arguments as necessary.
        Parameters:
        classLoader - the source classloader
        names - the class names to instantiate
        Returns:
        a list of instantiated instances
        Since:
        2.4.8
      • instantiateTypes

        public java.util.List<T> instantiateTypes(java.util.Collection<java.lang.Class<?>> types)
        Instantiate the given set of classes, injecting constructor arguments as necessary.
        Parameters:
        types - the types to instantiate
        Returns:
        a list of instantiated instances
        Since:
        2.4.8