@SafeVarargs public static List<Option> from(Tuple2<String, String>... options) { return Arrays.stream(options).map(o -> new Option(o.a, o.b)).collect(Collectors.toList()); } }
public List<Option> options(List<Option> options) { return options.stream().map(o -> new Option(o)).collect(Collectors.toList()); }
private List<Option> handleResponse(Response httpResp) throws JsonSyntaxException, IOException { String resp = httpResp.returnContent().asString(); RuntimeOptionsResponse response = GsonSerializer .getGsonWithIds() .fromJson(resp, RuntimeOptionsResponse.class); return response .getOptions() .stream() .map(o -> new Option(o.getLabel(), o.getAdditionalPayload())) .collect(Collectors.toList()); }
private List<Option> handleResponse(Response httpResp) throws JsonSyntaxException, IOException { String resp = httpResp.returnContent().asString(); RuntimeOptionsResponse response = GsonSerializer .getGsonWithIds() .fromJson(resp, RuntimeOptionsResponse.class); return response .getOptions() .stream() .map(o -> new Option(o.getLabel(), o.getAdditionalPayload())) .collect(Collectors.toList()); }
@Override public SpecificAdapterStreamDescription declareModel() { return SpecificDataStreamAdapterBuilder.create(ID, "OpenSenseMap", "Environment Sensors") .iconUrl("openSenseMap.png") .requiredMultiValueSelection(Labels.from("sensors", "Sensors", "Select the " + "sensors that are included in the data stream"), Stream .of(SensorNames.ALL_SENSOR_LABELS) .map(s -> new Option(s, SensorNames.getKeyFromLabel(s))) .collect(Collectors.toList())) .build(); }
@Override public SpecificAdapterStreamDescription declareModel() { SpecificAdapterStreamDescription description = SpecificDataStreamAdapterBuilder.create(ID, "OpenSenseMap", "Environment Sensors") .iconUrl("openSenseMap.png") .requiredMultiValueSelection(Labels.from("sensors", "Sensors", "Select the " + "sensors that are included in the data stream"), Stream .of(SensorNames.ALL_SENSOR_LABELS) .map(s -> new Option(s, SensorNames.getKeyFromLabel(s))) .collect(Collectors.toList())) .build(); description.setAppId(ID); return description; }
@Override public FormatDescription declareModel() { FormatDescription fd = new FormatDescription(ID, "Csv", "This is the description" + "for csv format"); FreeTextStaticProperty delimiterProperty = new FreeTextStaticProperty("delimiter", "Delimiter", "The delimiter for json. Mostly either , or ;"); AnyStaticProperty offset = new AnyStaticProperty("header", "Header", "Does the CSV file include a header or not"); offset.setOptions(Arrays.asList(new Option("Header","Header"))); // FreeTextStaticProperty offset = new FreeTextStaticProperty("header", // "Includes Header", "Description"); fd.addConfig(delimiterProperty); fd.addConfig(offset); return fd; }
@Override public FormatDescription declareModel() { FormatDescription fd = new FormatDescription(ID, "Csv", "This is the description" + "for csv format"); FreeTextStaticProperty delimiterProperty = new FreeTextStaticProperty("delimiter", "Delimiter", "The delimiter for json. Mostly either , or ;"); fd.setAppId(ID); AnyStaticProperty offset = new AnyStaticProperty("header", "Header", "Does the CSV file include a header or not"); offset.setOptions(Arrays.asList(new Option("Header","Header"))); // // FreeTextStaticProperty offset = new FreeTextStaticProperty("header", // "Includes Header", "Description"); fd.addConfig(delimiterProperty); fd.addConfig(offset); return fd; }
for (int i = 0; i < data.length(); i++) { JSONObject object = data.getJSONObject(i); options.add(new Option(object.getString(value)));
for (int i = 0; i < data.length(); i++) { JSONObject object = data.getJSONObject(i); options.add(new Option(object.getString(value)));