public class AgentFinder extends Object
Constructor and Description |
---|
AgentFinder() |
Modifier and Type | Method and Description |
---|---|
<T> void |
addConverter(Class<T> clazz,
Function<String,T> converter)
Allow creation of custom converters.
|
void |
addFactory(String name,
AgentFactory factory)
Allow manual insertion of factories.
|
Agent |
buildAgent(String name,
String... args)
Generate an agent with a given name from this factory
|
AgentFactory |
buildFactory(Class<? extends Agent> agentClazz) |
AgentFactory |
buildFactory(Method method) |
Map<String,AgentFactory> |
getFactories() |
static void |
main(String[] args) |
static int[] |
parseIntArray(String data) |
public static void main(String[] args)
public static int[] parseIntArray(String data)
public <T> void addConverter(Class<T> clazz, Function<String,T> converter)
T
- the type that we expect to convert to.clazz
- the class to convertconverter
- the converter to usepublic void addFactory(String name, AgentFactory factory)
name
- the name of the factoryfactory
- the method that creates the agentpublic Agent buildAgent(String name, String... args)
name
- the name of the agentargs
- the arguments to pass to the factorypublic AgentFactory buildFactory(Method method)
public AgentFactory buildFactory(Class<? extends Agent> agentClazz)
public Map<String,AgentFactory> getFactories()
Copyright © 2017 FOSS Galaxy. All rights reserved.