Spring Data MongoDB

org.springframework.data.mongodb.core.mapping.event
Class ValidatingMongoEventListener

java.lang.Object
  extended by org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener<Object>
      extended by org.springframework.data.mongodb.core.mapping.event.ValidatingMongoEventListener
All Implemented Interfaces:
EventListener, ApplicationListener<MongoMappingEvent<?>>

public class ValidatingMongoEventListener
extends AbstractMongoEventListener<Object>

javax.validation dependant entities validator. When it is registered as Spring component its automatically invoked before entities are saved in database.

Author:
Maciej Walkowiak

Constructor Summary
ValidatingMongoEventListener(javax.validation.Validator validator)
          Creates a new ValidatingMongoEventListener using the given Validator.
 
Method Summary
 void onBeforeSave(Object source, com.mongodb.DBObject dbo)
           
 
Methods inherited from class org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener
onAfterConvert, onAfterLoad, onAfterSave, onApplicationEvent, onBeforeConvert
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatingMongoEventListener

public ValidatingMongoEventListener(javax.validation.Validator validator)
Creates a new ValidatingMongoEventListener using the given Validator.

Parameters:
validator - must not be null.
Method Detail

onBeforeSave

public void onBeforeSave(Object source,
                         com.mongodb.DBObject dbo)
Overrides:
onBeforeSave in class AbstractMongoEventListener<Object>

Spring Data MongoDB

Copyright © 2011-2013-2013 SpringSource. All Rights Reserved.