Class Factory.Named.Util

java.lang.Object
com.hierynomus.protocol.commons.Factory.Named.Util
Enclosing interface:
Factory.Named<T>

public static class Factory.Named.Util extends Object
Utility functions
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • create

      public static <T> T create(List<Factory.Named<T>> factories, 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(List<Factory.Named<T>> factories, 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> List<String> getNames(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