01: // Copyright 2006, 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.services;
16:
17: import org.apache.tapestry.ioc.ObjectLocator;
18: import org.apache.tapestry.model.MutableComponentModel;
19:
20: /**
21: * Provides some form of injection when the value for an
22: * {@link org.apache.tapestry.annotations.Inject} annotation is blank. In this case, the provider is
23: * responsible for determining the value to be injected from the field name and field type.
24: * <p>
25: * This interface will be used as part of a
26: * {@link org.apache.tapestry.ioc.services.ChainBuilder chain of command}.
27: *
28: *
29: */
30: public interface InjectionProvider {
31: /**
32: * Peform the injection, if possible. Most often, this will result in a call to
33: * {@link ClassTransformation#injectField(String, Object)}. The caller is responsible for
34: * invoking {@link ClassTransformation#claimField(String, Object)}.
35: *
36: * @param fieldName
37: * the name of the field requesting injection
38: * @param fieldType
39: * the type of the field (as a string)
40: * @param locator
41: * allows services to be located
42: * @param transformation
43: * allows the code for the class to be transformed
44: * @param componentModel
45: * defines the relevant aspects of the component
46: * @return true if an injection has been made (terminates the command chain), false to continue
47: * down the chain
48: */
49: boolean provideInjection(String fieldName, String fieldType,
50: ObjectLocator locator, ClassTransformation transformation,
51: MutableComponentModel componentModel);
52: }
|