001 // Copyright 2006, 2007, 2011 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry5.services; 016 017 import org.apache.tapestry5.ioc.ObjectLocator; 018 import org.apache.tapestry5.model.MutableComponentModel; 019 020 /** 021 * Provides some form of injection when the value for an {@link org.apache.tapestry5.ioc.annotations.Inject} annotation is 022 * present. In this case, the provider is responsible for determining the value to be injected from the field name and 023 * field type. 024 * <p/> 025 * This interface will be used as part of a {@link org.apache.tapestry5.ioc.services.ChainBuilder chain of command}. 026 * 027 * @deprecated Deprecated in 5.3, use {@link org.apache.tapestry5.services.transform.InjectionProvider2} instead. Instances 028 * of InjectProvider will be {@linkplain org.apache.tapestry5.ioc.services.TypeCoercer coerced} to InjectionProvider2. 029 */ 030 public interface InjectionProvider 031 { 032 /** 033 * Perform the injection, if possible. Most often, this will result in a call to {@link 034 * TransformField#inject(Object)}. The caller is responsible for claiming the field. 035 * 036 * @param fieldName the name of the field requesting injection 037 * @param fieldType the type of the field 038 * @param locator allows services to be located 039 * @param transformation allows the code for the class to be transformed 040 * @param componentModel defines the relevant aspects of the component 041 * @return true if an injection has been made (terminates the command chain), false to continue down the chain 042 */ 043 boolean provideInjection(String fieldName, Class fieldType, ObjectLocator locator, 044 ClassTransformation transformation, MutableComponentModel componentModel); 045 }