com.petpet.c3po.dao.mongo
Class MongoFilterSerializer

java.lang.Object
  extended by com.petpet.c3po.dao.mongo.MongoFilterSerializer

public class MongoFilterSerializer
extends Object

The MongoFilterSerializer translates a filter object to a DBObject query, so that the dataset is first filtered and then the persistence layer function is applied.

Author:
Petar Petrov

Constructor Summary
MongoFilterSerializer()
           
 
Method Summary
 String mapFieldToProperty(String f, Object value)
          Wraps the field within a metadata.[field].value if necessary, so that it corresponds to the current element structure.
 com.mongodb.DBObject serialize(Filter filter)
          Serializes the given filter according to the strategy proposed here: Filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongoFilterSerializer

public MongoFilterSerializer()
Method Detail

serialize

public com.mongodb.DBObject serialize(Filter filter)
Serializes the given filter according to the strategy proposed here: Filter. If the filter is null, then an empty DBObject is returned.

Parameters:
filter - the filter to serialize.
Returns:
the Mongo DBObject

mapFieldToProperty

public String mapFieldToProperty(String f,
                                 Object value)
Wraps the field within a metadata.[field].value if necessary, so that it corresponds to the current element structure.

Parameters:
f - the field to wrap
Returns:
the wrapped field.


Copyright © 2013. All Rights Reserved.