Spring Data Document

org.springframework.data.mongodb.core
Class SerializationUtils

java.lang.Object
  extended by org.springframework.data.mongodb.core.SerializationUtils

public abstract class SerializationUtils
extends Object

Utility methods for JSON serialization.

Author:
Oliver Gierke

Method Summary
static String serializeToJsonSafely(Object value)
          Serializes the given object into pseudo-JSON meaning it's trying to create a JSON representation as far as possible but falling back to the given object's Object.toString() method if it's not serializable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

serializeToJsonSafely

public static String serializeToJsonSafely(Object value)
Serializes the given object into pseudo-JSON meaning it's trying to create a JSON representation as far as possible but falling back to the given object's Object.toString() method if it's not serializable. Useful for printing raw DBObjects containing complex values before actually converting them into Mongo native types.

Parameters:
value -
Returns:

Spring Data Document

Copyright © 2012. All Rights Reserved.