Package com.hierynomus.protocol.commons
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 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 fromfactories
that is identified byname
from a list of namedfactories
.static <T> Factory.Named<T>
get(java.util.List<Factory.Named<T>> factories, java.lang.String name)
Retrieve a particular factory as identified byname
from a list of namedfactories
.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 offactories
.
-
-
-
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 fromfactories
that is identified byname
from a list of namedfactories
. Uses the first match.- Type Parameters:
T
- type of thefactories
- Parameters:
factories
- list of available factoriesname
- name of the desired factory- Returns:
- a newly created instance of
T
ornull
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 byname
from a list of namedfactories
. Returns the first match.- Type Parameters:
T
- type of thefactories
- Parameters:
factories
- list of factoriesname
- 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 offactories
.- Type Parameters:
T
- type of thefactories
- Parameters:
factories
- list of available factories- Returns:
- a comma separated list of factory names
-
-