Skip to main content
summaryrefslogtreecommitdiffstats
blob: 06ec258b6bfcb25e1e0370e5e3894b53cd522872 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package org.eclipse.fx.code.editor.configuration.gson;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import java.util.List;

public interface GsonBase {
	public static JsonArray toJsonArray(List<JsonElement> list) {
		JsonArray ar = new JsonArray();
		list.stream().forEach(ar::add);
		return ar;
	}

	public static JsonArray toDomainJsonArray(List<?> list) {
		JsonArray ar = new JsonArray();
		list.stream().map( e -> (GsonBase)e ).map(GsonBase::toJSONObject).forEach(ar::add);
		return ar;
	}

	public JsonObject toJSONObject();
}

Back to the top