All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openlca.io.openepd.Ec3Certifier Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package org.openlca.io.openepd;

import java.util.Optional;

import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.openlca.jsonld.Json;

public class Ec3Certifier implements Jsonable {

	public String name;
	public String email;
	public EpdOrg org;

	public static Optional fromJson(JsonElement elem) {
		if (elem == null || !elem.isJsonObject())
			return Optional.empty();
		var obj = elem.getAsJsonObject();
		var certifier = new Ec3Certifier();
		certifier.name = Json.getString(obj, "name");
		certifier.email = Json.getString(obj, "email");
		certifier.org = EpdOrg.fromJson(obj.get("org")).orElse(null);
		return Optional.of(certifier);
	}

	@Override
	public JsonObject toJson() {
		var obj = new JsonObject();
		Json.put(obj, "name", name);
		Json.put(obj, "email", email);
		Util.put(obj,"org", org);
		return obj;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy