yui.comn.hub.data.parser.HubDataToMapParser Maven / Gradle / Ivy
The newest version!
/**
* Project: yui3-common-hub
* Class HubDataToMapParser
* Version 1.0
* File Created at 2018年8月17日
* $Id$
*
* Copyright 2010-2015 Yui.com Corporation Limited.
* All rights reserved.
*
* This software is the confidential and proprietary information of
* Yui Personal. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Yui.com.
*/
package yui.comn.hub.data.parser;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import yui.comn.hub.data.handler.HubDataHandlerProcess;
import yui.comn.hub.data.parser.handler.HubDataParseRegister;
import yui.comn.hub.data.parser.handler.impl.MapParseHandler;
import yui.comn.hub.model.HubXmlColumn;
import yui.comn.hub.xml.parser.HubXmlCache;
/**
* 把Dto对象解析成map对象
* @author yuyi ([email protected])
*/
public class HubDataToMapParser {
// private Logger logger = LoggerFactory.getLogger(HubDataToMapParser.class);
private String parserName = MapParseHandler.REG_NAME;
private static HubDataToMapParser parser = new HubDataToMapParser();
public static HubDataToMapParser getInstance() {
return parser;
}
public void setParserName(String parserName) {
this.parserName = parserName;
}
/**
* 对象转Map
*/
public Map toMapByObj(Class> clazz, String name, Object obj) {
if (obj == null) {
return null;
}
List colList = HubXmlCache.getInstance().toGridList(clazz, name);
return toMapByObj(colList, obj);
}
/**
* 列表转Map列表
*/
public List