com.iqiny.silly.spring.spel.field.SillyParseJsonMethodValuesField Maven / Gradle / Ivy
/*
* Copyright iqiny.com
*
* https://gitee.com/iqiny/silly
*
* project name:silly-spring
* project description:top silly project pom.xml file
*/
package com.iqiny.silly.spring.spel.field;
import com.alibaba.fastjson.JSONObject;
import com.iqiny.silly.core.config.property.valuesfield.BaseSillyMethodPropertyValuesField;
import com.iqiny.silly.core.savehandle.SillyOnceSourceData;
import org.springframework.stereotype.Component;
/**
* json转对象
*/
@Component
public class SillyParseJsonMethodValuesField extends BaseSillyMethodPropertyValuesField {
public static final String NAME = "parseJson";
@Override
public String fieldName() {
return NAME;
}
@Override
protected Class>[] getParameterTypes(SillyOnceSourceData data) {
return new Class[]{String.class};
}
public static Object parseJson(String json) {
return JSONObject.parse(json);
}
}