net.schmizz.sshj.common
Class Factory.Named.Util

java.lang.Object
  extended by net.schmizz.sshj.common.Factory.Named.Util
Enclosing interface:
Factory.Named<T>

public static class Factory.Named.Util
extends Object

Utility functions


Constructor Summary
Factory.Named.Util()
           
 
Method Summary
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.
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.
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Factory.Named.Util

public Factory.Named.Util()
Method Detail

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


Copyright © 2009-2012. All Rights Reserved.