Java Code Examples for com.typesafe.config.Config#getAnyRefList()
The following examples show how to use
com.typesafe.config.Config#getAnyRefList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AgentClient.java From amcgala with Educational Community License v2.0 | 6 votes |
public AgentClient(String agentConfiguration) { Config config = ConfigFactory.load().getConfig("client").withFallback(ConfigFactory.load(agentConfiguration).withFallback(ConfigFactory.load("amcgala"))); boolean localMode = config.getBoolean("org.amcgala.agent.simulation.local-mode"); if (localMode) { system = ActorSystem.create("Client", config); ActorRef simulationManager = system.actorOf(Props.create(SimulationManager.class), "simulation-manager"); simulationManager.tell(new SimulationManager.SimulationCreation(config), ActorRef.noSender()); }else{ system = ActorSystem.create("Client", config); } List<List<String>> lists = (List<List<String>>) config.getAnyRefList("org.amcgala.agent.client.agents"); for (List<String> l : lists) { try { int numberOfAgents = Integer.parseInt(l.get(0)); Class agentClass = ClassLoader.getSystemClassLoader().loadClass(l.get(1)); createAgents(numberOfAgents, agentClass); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
Example 2
Source File: ConfigBeanImpl.java From mpush with Apache License 2.0 | 5 votes |
private static Object getListValue(Class<?> beanClass, Type parameterType, Class<?> parameterClass, Config config, String configPropName) { Type elementType = ((ParameterizedType) parameterType).getActualTypeArguments()[0]; if (elementType == Boolean.class) { return config.getBooleanList(configPropName); } else if (elementType == Integer.class) { return config.getIntList(configPropName); } else if (elementType == Double.class) { return config.getDoubleList(configPropName); } else if (elementType == Long.class) { return config.getLongList(configPropName); } else if (elementType == String.class) { return config.getStringList(configPropName); } else if (elementType == Duration.class) { return config.getDurationList(configPropName); } else if (elementType == ConfigMemorySize.class) { return config.getMemorySizeList(configPropName); } else if (elementType == Object.class) { return config.getAnyRefList(configPropName); } else if (elementType == Config.class) { return config.getConfigList(configPropName); } else if (elementType == ConfigObject.class) { return config.getObjectList(configPropName); } else if (elementType == ConfigValue.class) { return config.getList(configPropName); } else { throw new ConfigException.BadBean("Bean property '" + configPropName + "' of class " + beanClass.getName() + " has unsupported list element type " + elementType); } }
Example 3
Source File: ConfigurationContext.java From Decision with Apache License 2.0 | 5 votes |
private Object getListOrNull(String key, Config config) { if (config.hasPath(key)) { return config.getAnyRefList(key); } else { return null; } }