import java.util.function.BiFunction;
-import com.google.gson.Gson;
import com.google.gson.JsonElement;
+import net.mograsim.logic.model.util.JsonHandler;
+
public interface SnippetDefinintion<C, P, S>
{
public Class<P> getParamClass();
throw new IllegalArgumentException("Params given where none were expected");
return create(context, (P) null);
}
- return create(context, new Gson().fromJson(params, getParamClass()));
+ return create(context, JsonHandler.fromJson(params, getParamClass()));
}
public static <C, P, S> SnippetDefinintion<C, P, S> create(Class<P> paramClass, BiFunction<C, P, S> supplier)
return parser.fromJson(src, type);
}
+ public static <T> T fromJson(JsonElement json, Class<T> type)
+ {
+ return parser.fromJson(json, type);
+ }
+
public static <T> T fromJsonTree(JsonElement src, Class<T> type)
{
return parser.fromJson(src, type);