org.iternine.jeppetto.dao.mongodb.enhance
Class DBObjectUtil

java.lang.Object
  extended by org.iternine.jeppetto.dao.mongodb.enhance.DBObjectUtil

public class DBObjectUtil
extends Object


Constructor Summary
DBObjectUtil()
           
 
Method Summary
static Object fromObject(Class<?> type, Object o, Class<?>... typeParameters)
           
static boolean needsNoConversion(Class clazz)
           
static boolean objectIsMutable(Object object)
          Returns true if the given object is a "mutable" type that needs to be enhanced as DirtyableDBObject to prevent lost changes.
static Object toDBObject(Class<?> cls, boolean obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, byte obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, double obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, float obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, int obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, long obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, Object obj, Type... optionalValueTypes)
           
static Object toDBObject(Class<?> cls, short obj, Type... optionalValueTypes)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBObjectUtil

public DBObjectUtil()
Method Detail

objectIsMutable

public static boolean objectIsMutable(Object object)
Returns true if the given object is a "mutable" type that needs to be enhanced as DirtyableDBObject to prevent lost changes. Array types are ok because the default isDirty method will detect changes there.

Parameters:
object - object to check
Returns:
true if mutable, false otherwise

needsNoConversion

public static boolean needsNoConversion(Class clazz)

fromObject

public static Object fromObject(Class<?> type,
                                Object o,
                                Class<?>... typeParameters)

toDBObject

public static Object toDBObject(Class<?> cls,
                                Object obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                boolean obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                byte obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                short obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                int obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                long obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                float obj,
                                Type... optionalValueTypes)

toDBObject

public static Object toDBObject(Class<?> cls,
                                double obj,
                                Type... optionalValueTypes)


Copyright © 2012. All Rights Reserved.