    001// Licensed under the Apache License, Version 2.0 (the "License");
    002// you may not use this file except in compliance with the License.
    003// You may obtain a copy of the License at
    004//
    005//     http://www.apache.org/licenses/LICENSE-2.0
    006//
    007// Unless required by applicable law or agreed to in writing, software
    008// distributed under the License is distributed on an "AS IS" BASIS,
    009// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    010// See the License for the specific language governing permissions and
    011// limitations under the License.
    012
    013package org.apache.tapestry5.services.transform;
    014
    015import org.apache.tapestry5.ioc.ObjectLocator;
    016import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;
    017import org.apache.tapestry5.model.MutableComponentModel;
    018import org.apache.tapestry5.plastic.PlasticField;
    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 *
    025 * This interface will be used as part of a {@link org.apache.tapestry5.ioc.services.ChainBuilder chain of command}.
    026 */
    027@UsesOrderedConfiguration(InjectionProvider2.class)
    028public interface InjectionProvider2
    029{
    030    /**
    031     * Perform the injection, if possible. Most often, this will result in a call to {@link
    032     * org.apache.tapestry5.plastic.PlasticField#inject(Object)}. The caller is responsible for invoking {@link
    033     * org.apache.tapestry5.plastic.PlasticField#claim(Object)}.
    034     *
    035     * @param field          that has the {@link org.apache.tapestry5.ioc.annotations.Inject} annotation
    036     * @param locator        allows services to be located
    037     * @param componentModel defines the relevant aspects of the component
    038     * @return true if an injection has been made (terminates the command chain), false to continue down the chain
    039     */
    040    boolean provideInjection(PlasticField field, ObjectLocator locator,
    041                             MutableComponentModel componentModel);
    042}
    043