1 /* 2 * #%L 3 * ValidatingReplyCallback.java - mongodb-async-driver - Allanbank Consulting, Inc. 4 * %% 5 * Copyright (C) 2011 - 2014 Allanbank Consulting, Inc. 6 * %% 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * #L% 19 */ 20 21 package com.allanbank.mongodb.client.callback; 22 23 import com.allanbank.mongodb.MongoDbException; 24 import com.allanbank.mongodb.client.message.Reply; 25 26 /** 27 * ValidatingCallback to expect and extract a single document from the reply. 28 * The document is checked for errors but then ignored. 29 * 30 * @api.no This class is <b>NOT</b> part of the drivers API. This class may be 31 * mutated in incompatible ways between any two releases of the driver. 32 * @copyright 2014, Allanbank Consulting, Inc., All Rights Reserved 33 */ 34 public class ValidatingReplyCallback extends AbstractReplyCallback<Reply> { 35 36 /** 37 * Create a new ValidatingReplyCallback. 38 * 39 * @param delegate 40 * The delegate that we can wait on for the reply. 41 */ 42 public ValidatingReplyCallback(final FutureReplyCallback delegate) { 43 super(delegate); 44 } 45 46 /** 47 * {@inheritDoc} 48 * <p> 49 * Overridden to return true as there is no additional processing. 50 * </p> 51 */ 52 @Override 53 public boolean isLightWeight() { 54 return true; 55 } 56 57 /** 58 * {@inheritDoc} 59 * <p> 60 * Overridden to return the original reply. 61 * </p> 62 */ 63 @Override 64 protected Reply convert(final Reply reply) throws MongoDbException { 65 return reply; 66 } 67 }