package com.persagy.revit.converter

import com.alibaba.fastjson.JSONObject
import com.persagy.revit.models.modelFile.ModelFile
import org.springframework.core.convert.converter.Converter
import org.springframework.stereotype.Component
import org.springframework.util.StringUtils

/**
 * Controller转换器
 */
@Component
class ModelFileConverter : Converter<String, ModelFile> {
    override fun convert(source: String): ModelFile? {
        if (StringUtils.isEmpty(source)) {
            return null
        }
        val obj = JSONObject.parseObject(source)
        return obj.toJavaObject(ModelFile::class.java)
    }
}
