static MimeType mimeTypeFromObject(Object obj) {
			Assert.notNull(obj, "object cannot be null.");
			if (obj instanceof byte[]) {
				return APPLICATION_OCTET_STREAM_MIME_TYPE;
			}
			if (obj instanceof String) {
				return TEXT_PLAIN_MIME_TYPE;
			}
			String className = obj.getClass().getName();
			MimeType mimeType = mimeTypesCache.get(className);
			if (mimeType == null) {
				String modifiedClassName = className;
				if (obj.getClass().isArray()) {
					// Need to remove trailing ';' for an object array, e.g. "[Ljava.lang.String;" or multi-dimensional
					// "[[[Ljava.lang.String;"
					if (modifiedClassName.endsWith(";")) {
						modifiedClassName = modifiedClassName.substring(0, modifiedClassName.length() - 1);
					}
					// Wrap in quotes to handle the illegal '[' character
					modifiedClassName = "\"" + modifiedClassName + "\"";
				}
				mimeType = MimeType.valueOf("application/x-java-object;type=" + modifiedClassName);
				mimeTypesCache.put(className, mimeType);
			}
			return mimeType;
		}
Handles representing any java class as a {@link MimeType}.
@author David Turanski
@see <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getName"/>
spring-xd-messagebus-spi/src/main/java/org/springframework/xd/dirt/integration/bus/MessageBusSupport.java