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

com.soento.core.lang.BaseObject Maven / Gradle / Ivy

package com.soento.core.lang;


import com.soento.core.util.BeanUtil;
import com.soento.core.util.JsonUtil;
import com.soento.core.util.StringUtil;

import java.io.Serializable;
import java.util.Map;

/**
 * @author yantao.zeng
 */
public class BaseObject implements Serializable {

    @Override
    public String toString() {
        return StringUtil.toSimpleString(this);
    }

    public Map toMap() {
        try {
            return (Map) BeanUtil.describe(this);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public String toJson() {
        return JsonUtil.toJson(this);
    }

    public String toJsonp(String function) {
        return JsonUtil.toJsonp(function, this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy