class BeanToMapConvertor implements Cloneable {

	@SuppressWarnings("unchecked")
	public Map<String, Object> toMap(final Object obj){
//		return ReflectUtils.toMap(obj, propertyAcceptor, valueConvertor);
		if (obj == null)
			return Collections.emptyMap();
		
		if(obj.getClass().isArray())
			return CUtils.asMap((Object[])obj);
		
		if(obj instanceof Map)
			return (Map<String, Object>)obj;
		
		ObjectWrapper objWrapper = objectWrapper(obj);
		PropertyDescriptor[] props = objWrapper.desribProperties();
		if (props == null || props.length == 0)
			return Collections.emptyMap();
		Map<String, Object> rsMap = new HashMap<>();
		Object val = null;
		for (PropertyDescriptor prop : props) {
			val = objWrapper.getPropertyValue(prop);
			ObjectPropertyContext propContext = createPropertyContext(obj, prop, null);
			if (propertyAcceptor==null || propertyAcceptor.apply(propContext, val)){
				/*if(valueConvertor!=null){
					Object newVal = valueConvertor.apply(prop, val);
					val = (newVal!=null?newVal:val);
				}*/
				val = convertValue(prop, val);
//				PropertyContext propContext = createPropertyContext(obj, prop);
				rsMap.put(toPropertyName(propContext.getConvertedName()), val);
			}
		}
		return rsMap;
	}

}