Class Factory.Named.Util

  • Enclosing interface:
    Factory.Named<T>

    public static class Factory.Named.Util
    extends java.lang.Object
    Utility functions
    • Constructor Summary

      Constructors 
      Constructor Description
      Util()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> T create​(java.util.List<Factory.Named<T>> factories, java.lang.String name)
      Creates an object by picking a factory from factories that is identified by name from a list of named factories.
      static <T> Factory.Named<T> get​(java.util.List<Factory.Named<T>> factories, java.lang.String name)
      Retrieve a particular factory as identified by name from a list of named factories.
      static <T> java.util.List<java.lang.String> getNames​(java.util.List<Factory.Named<T>> factories)
      Get a comma-delimited string containing the factory names from the given list of factories.
      • Methods inherited from class java.lang.Object

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

      • Util

        public Util()
    • Method Detail

      • create

        public static <T> T create​(java.util.List<Factory.Named<T>> factories,
                                   java.lang.String name)
        Creates an object by picking a factory from factories that is identified by name from a list of named factories. Uses the first match.
        Type Parameters:
        T - type of the factories
        Parameters:
        factories - list of available factories
        name - name of the desired factory
        Returns:
        a newly created instance of T or null if there was no match
      • get

        public static <T> Factory.Named<T> get​(java.util.List<Factory.Named<T>> factories,
                                               java.lang.String name)
        Retrieve a particular factory as identified by name from a list of named factories. Returns the first match.
        Type Parameters:
        T - type of the factories
        Parameters:
        factories - list of factories
        name - the name of the factory to retrieve
        Returns:
        a factory or null if there was no match
      • getNames

        public static <T> java.util.List<java.lang.String> getNames​(java.util.List<Factory.Named<T>> factories)
        Get a comma-delimited string containing the factory names from the given list of factories.
        Type Parameters:
        T - type of the factories
        Parameters:
        factories - list of available factories
        Returns:
        a comma separated list of factory names