01: /*
02: * $Id: IFieldValueFactory.java 458351 2005-12-23 23:00:29Z ivaynberg $
03: * $Revision: 458351 $
04: * $Date: 2005-12-24 00:00:29 +0100 (Sat, 24 Dec 2005) $
05: *
06: * ==============================================================================
07: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
08: * use this file except in compliance with the License. You may obtain a copy of
09: * 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, WITHOUT
15: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16: * License for the specific language governing permissions and limitations under
17: * the License.
18: */
19: package wicket.injection;
20:
21: import java.lang.reflect.Field;
22:
23: /**
24: * Factory object used by injector to generate values for fields of the object
25: * being injected.
26: *
27: * @author Igor Vaynberg (ivaynberg)
28: *
29: */
30: public interface IFieldValueFactory {
31: /**
32: * Returns the value the field will be set to
33: *
34: * @param field
35: * field being injected
36: * @param fieldOwner
37: * instance of object being injected
38: *
39: * @return new field value
40: */
41: Object getFieldValue(Field field, Object fieldOwner);
42:
43: /**
44: * Returns true if the factory can generate a value for the field, false
45: * otherwise.
46: *
47: * If this method returns false, getFieldValue() will not be called on this
48: * factory
49: *
50: * @param field
51: * field
52: * @return true if the factory can generate a value for the field, false
53: * otherwise
54: */
55: boolean supportsField(Field field);
56: }
|