public ApplicationModuleDescriptor(JSON json) { LinkedHashSet<Name> names = new LinkedHashSet<Name>(); for (String name : json.names()) { names.add(Name.parse(name)); } // this.names = names; }
public ApplicationModuleDescriptor(JSON json) { LinkedHashSet<Name> names = new LinkedHashSet<Name>(); for (String name : json.names()) { names.add(Name.parse(name)); } // this.names = names; }
JSON config = (JSON)JSON.parse(serializedConfig); JSON applications = config.getJSON("application"); if (applications.names().size() != 1) { throw new RuntimeException("Was expecting application size to be 1 instead of " + applications); String packageFQN = applications.names().iterator().next(); ApplicationDescriptor descriptor = ApplicationDescriptor.create(cl, packageFQN);
JSON config = (JSON)JSON.parse(serializedConfig); JSON applications = config.getJSON("application"); if (applications.names().size() != 1) { throw new RuntimeException("Was expecting application size to be 1 instead of " + applications); String packageFQN = applications.names().iterator().next(); ApplicationDescriptor descriptor = ApplicationDescriptor.create(cl, packageFQN);
if (assets != null && assets.getSize() > 0) { abc = new ArrayList<AssetMetaData>(); for (String id : assets.names()) { JSON asset = assets.getJSON(id); AssetLocation location = AssetLocation.safeValueOf(asset.getString("location"));
if (assets != null && assets.getSize() > 0) { abc = new ArrayList<AssetMetaData>(); for (String id : assets.names()) { JSON asset = assets.getJSON(id); AssetLocation location = AssetLocation.safeValueOf(asset.getString("location"));
plugins.put(plugin.getName(), plugin); HashSet<String> names = new HashSet<String>(descriptor.getConfig().names()); HashMap<ApplicationService, JSON> configs = new HashMap<ApplicationService, JSON>(); for (ApplicationService plugin : plugins.values()) {
plugins.put(plugin.getName(), plugin); HashSet<String> names = new HashSet<String>(descriptor.getConfig().names()); HashMap<ApplicationService, JSON> configs = new HashMap<ApplicationService, JSON>(); for (ApplicationService plugin : plugins.values()) {
public RouteDescriptor(JSON config) { HashMap<String, ParamDescriptor> parameters = null; JSON foo = config.getJSON("parameters"); if (foo != null) { parameters = new HashMap<String, ParamDescriptor>(); for (String name : foo.names()) { String pattern = foo.getJSON(name).getString("pattern"); Boolean preservePath = foo.getJSON(name).getBoolean("preserve-path"); Boolean captureGroup = foo.getJSON(name).getBoolean("capture-group"); parameters.put(name, new ParamDescriptor(pattern, preservePath, captureGroup)); } } // this.path = config.getString("path"); this.handle = MethodHandle.parse(config.getString("handle")); this.parameters = parameters; }
public RouteDescriptor(JSON config) { HashMap<String, ParamDescriptor> parameters = null; JSON foo = config.getJSON("parameters"); if (foo != null) { parameters = new HashMap<String, ParamDescriptor>(); for (String name : foo.names()) { String pattern = foo.getJSON(name).getString("pattern"); Boolean preservePath = foo.getJSON(name).getBoolean("preserve-path"); Boolean captureGroup = foo.getJSON(name).getBoolean("capture-group"); parameters.put(name, new ParamDescriptor(pattern, preservePath, captureGroup)); } } // this.path = config.getString("path"); this.handle = MethodHandle.parse(config.getString("handle")); this.parameters = parameters; }
@Test public void testReadMap() throws Exception { JSON o = (JSON)JSON.parse("{\"a\":\"b\"}"); assertEquals(Collections.singleton("a"), o.names()); assertEquals("b", o.get("a")); }
@Test public void testReadMap() throws Exception { JSON o = (JSON)JSON.parse("{\"a\":\"b\"}"); assertEquals(Collections.singleton("a"), o.names()); assertEquals("b", o.get("a")); }
for (String name : jsonParams.names()) { List<? extends String> value = jsonParams.getList(name, String.class); parameters.put(name, value.toArray(new String[value.size()]));
for (String name : jsonParams.names()) { List<? extends String> value = jsonParams.getList(name, String.class); parameters.put(name, value.toArray(new String[value.size()]));