xxl.mathematica.io.ImportString Maven / Gradle / Ivy
package xxl.mathematica.io;
import com.google.gson.reflect.TypeToken;
import io.vavr.control.Try;
import org.apache.commons.lang3.ClassUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import xxl.mathematica.map.AssociationMap;
import xxl.mathematica.map.KeySelect;
import xxl.mathematica.map.Keys;
import xxl.mathematica.single.GsonSingle;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import java.io.StringReader;
import java.util.*;
/**
* 导入字符串
*/
public class ImportString {
/**
* 导入字符串
*
* @param json
* @param cls
* @param
* @return
*/
public static T importJsonObject(String json, Class cls) {
return GsonSingle.instance().fromJson(json, cls);
}
/**
* 导入json字符串为Map对象
*
* @param json
* @return
*/
public static Map importJsonMapObject(String json) {
return GsonSingle.instance().fromJson(json, new TypeToken
© 2015 - 2025 Weber Informatics LLC | Privacy Policy