FixedValue.java revision 674060f01e9090cd21b3c5656cc3204912ad17a6
1/* 2 * Copyright 2003 The Apache Software Foundation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16package org.mockito.cglib.proxy; 17 18/** 19 * {@link Enhancer} callback that simply returns the value to return 20 * from the proxied method. No information about what method 21 * is being called is available to the callback, and the type of 22 * the returned object must be compatible with the return type of 23 * the proxied method. This makes this callback primarily useful 24 * for forcing a particular method (through the use of a {@link CallbackFilter} 25 * to return a fixed value with little overhead. 26 */ 27public interface FixedValue extends Callback { 28 /** 29 * Return the object which the original method invocation should 30 * return. This method is called for <b>every</b> method invocation. 31 * @return an object matching the type of the return value for every 32 * method this callback is mapped to 33 */ 34 Object loadObject() throws Exception; 35} 36