org.apache.sshd.common
Class NamedFactory.Utils

java.lang.Object
  extended by org.apache.sshd.common.NamedFactory.Utils
Enclosing interface:
NamedFactory<T>

public static class NamedFactory.Utils
extends Object

Utility class to help using NamedFactories


Constructor Summary
NamedFactory.Utils()
           
 
Method Summary
static
<T> T
create(List<NamedFactory<T>> factories, String name)
          Create an instance of the specified name by looking up the needed factory in the list.
static
<T> NamedFactory<T>
get(List<NamedFactory<T>> factories, String name)
          Retrieve the factory identified by its name from the list.
static
<T> String
getNames(List<NamedFactory<T>> factories)
          Get a comma separated list of the factory names from the given list.
static
<T> NamedFactory<T>
remove(List<NamedFactory<T>> factories, String name)
          Remove the factory identified by the name from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedFactory.Utils

public NamedFactory.Utils()
Method Detail

create

public static <T> T create(List<NamedFactory<T>> factories,
                           String name)
Create an instance of the specified name by looking up the needed factory in the list.

Type Parameters:
T - type of object to create
Parameters:
factories - list of available factories
name - the factory name to use
Returns:
a newly created object or null if the factory is not in the list

getNames

public static <T> String getNames(List<NamedFactory<T>> factories)
Get a comma separated list of the factory names from the given list.

Type Parameters:
T - type of object to create
Parameters:
factories - list of available factories
Returns:
a comma separated list of factory names

remove

public static <T> NamedFactory<T> remove(List<NamedFactory<T>> factories,
                                         String name)
Remove the factory identified by the name from the list.

Type Parameters:
T - type of object to create
Parameters:
factories - list of factories
name - the name of the factory to remove
Returns:
the factory removed from the list or null if not in the list

get

public static <T> NamedFactory<T> get(List<NamedFactory<T>> factories,
                                      String name)
Retrieve the factory identified by its name from the list.

Type Parameters:
T - type of object create by the factories
Parameters:
factories - list of available factories
name - the name of the factory to retrieve
Returns:
a factory or null if not found in the list


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.