![JAR search and dependency download from the Maven repository](/logo.png)
org.gdl2.runtime.DefaultObjectCreator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gdl2 Show documentation
Show all versions of gdl2 Show documentation
Guideline Definition Language v2 reference java implementation
The newest version!
package org.gdl2.runtime;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.util.Map;
/**
* The default object creator that creates simple objects based
* on classes known to gdl2 library, e.g. built-in data types
*/
public class DefaultObjectCreator implements ObjectCreatorPlugin {
private Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").create();
@Override
public Object create(String modelId, Map values) throws ClassNotFoundException {
String json = gson.toJson(values);
Class modelClass = Class.forName(modelId);
return gson.fromJson(json, modelClass);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy