对象转Map
<p>Function: toMap</p>
<p>Description: </p>

@param object
@return
@author acexy@thankjava.com
@date 2016年3月8日 下午5:01:19
@version 1.0
165237
public static Map<String, Object> toMap(Object object) {
        if (object == null) {
            return null;
        }
        return toMap(toJSONString(object));
    }
489592
public static <T> Map<String, Object> toMap(T bean) {
        Map<String, Object> map = null;
        try {
            map = PropertyUtils.describe(bean);
            map.remove("class");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return map;
    }
852899
@Override
    public byte[] toBytes(Object object)
    {
        return object != null ? fromInt(Float.floatToRawIntBits((Float) object)) : null;
    }
418188
public static byte[] objectToBytes(Object object) throws IOException {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream os = new ObjectOutputStream(baos);
    os.writeObject(object);
    return baos.toByteArray();
  }
734848
public static Map toMap(String json) {
        try {
            return mapper.readValue(json, Map.class);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
440934
@Override
    public Map<String, Object> toMap() {
        Map<String, Object> map = new HashMap<>();
        map.put(this.getClass().getSimpleName().toLowerCase(), toString());
        return map;
    }
1241768
public static Map<String, Object> toMap(String value) {
		Map<String, Object> result = toNullableMap(value);
		return result != null ? result : new HashMap<String, Object>();
	}
293413
public static byte[] toByteArray( Serializable object )
	{
	    try
	    {
            ByteArrayOutputStream buf = new ByteArrayOutputStream(1024);
            ObjectOutputStream objOut = new ObjectOutputStream(buf);
            objOut.writeObject(object);
            objOut.close();
            return buf.toByteArray();
	    }
	    catch (IOException e)
	    {
	        throw new IllegalArgumentException("Cannot serialize object : "+e.toString());
	    }
	}
63887
private static String jsonEncode(Object object) throws IOException {
      
      ObjectMapper mapper = new ObjectMapper();
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      try {
         mapper.writeValue(outputStream, object);
         return new String(outputStream.toByteArray());
      } catch (JsonGenerationException e) {
         logger.severe("unable encode");
         throw new IOException(e);
      } catch (JsonMappingException e) {
         logger.severe("unable encode");
         throw new IOException(e.getMessage());
      }
      
   }
535034
@Override
  @NullSafe
  public Map<KEY, VALUE> toMap() {
    return Collections.unmodifiableMap(nullSafeMap(getMap()));
  }
270814
public Response post(Object object) {
        assertNotEmpty(object, "object");
        InputStream response = null;
        try {
            response = couchDbClient.post(new DatabaseURIHelper(dbUri).getDatabaseUri(),
                    getGson().toJson(object));
            return getResponse(response, Response.class, getGson());
        } finally {
            close(response);
        }
    }
93929
@Override
    public byte[] toBytes(Object object)
    {
        // if(object == null)
        // {
        // return null;
        // }
        // Timestamp t = (Timestamp) object;
        // return t.toString().getBytes();
        try
        {
            if (object == null)
            {
                return null;
            }
            LongAccessor longAccessor = new LongAccessor();
            return longAccessor.toBytes(((Timestamp) object).getTime());
            // return DATE_FORMATTER.format(((Date)
            // date)).getBytes(Constants.ENCODING);
        }
        catch (Exception e)
        {
            log.error("Error occured, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }
    }
277026
public Map<String, String> toMap(){
		Map<String, String> ret = new HashMap<>();
		ret.put("id", this.getID());
		ret.put("version", this.getVersion().toString());
		return ret;
	}
51940
public static <T extends Serializable> byte[] serializeObject( T object ) throws IOException {

		ByteArrayOutputStream os = new ByteArrayOutputStream();
		ObjectOutputStream out = new ObjectOutputStream( os );
		out.writeObject( object );

		return os.toByteArray();
	}
401006
public Map<String, String> toMap() {
		Map<String, String> map = new HashMap<String, String>();
		
		map.put("id", Integer.toString(id));
		map.put("status", Integer.toString(status));
		map.put("content", content);
		
		return map;
	}
1090283
public static String convertToXML(Object object) {
		try {
			if (!JAXB_CONTEXT_MAP.containsKey(object.getClass())) {
				JAXB_CONTEXT_MAP.put(object.getClass(), JAXBContext.newInstance(object.getClass()));
			}
			Marshaller marshaller = JAXB_CONTEXT_MAP.get(object.getClass()).createMarshaller();
			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
			// 设置CDATA输出字符
			marshaller.setProperty(CharacterEscapeHandler.class.getName(), new CharacterEscapeHandler() {
				public void escape(char[] ac, int i, int j, boolean flag, Writer writer) throws IOException {
					writer.write(ac, i, j);
				}
			});
			StringWriter stringWriter = new StringWriter();
			marshaller.marshal(object, stringWriter);
			return stringWriter.getBuffer().toString();
		} catch (Exception e) {
			logger.error("", e);
		}
		return null;
	}
693455
public Map<String, String> toMap() {
    Map<String, String> map = new HashMap<>(size());

    for (String propertyName : this) {
      map.put(propertyName, get(propertyName));
    }

    return map;
  }