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

com.iqiny.silly.spring.spel.field.SillyToJsonMethodValuesField 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.iqiny.silly.common.util.SillyObjectUtil;
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 SillyToJsonMethodValuesField extends BaseSillyMethodPropertyValuesField {

    public static final String NAME = "toJson";

    @Override
    public String fieldName() {
        return NAME;
    }

    @Override
    protected Class[] getParameterTypes(SillyOnceSourceData data) {
        return new Class[]{Object.class};
    }

    public static String toJson(Object object) {
        return SillyObjectUtil.objectToJsonString(object);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy