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.ioc.annotations;
014
015import java.lang.annotation.Documented;
016import java.lang.annotation.Retention;
017import java.lang.annotation.Target;
018
019import static java.lang.annotation.ElementType.FIELD;
020import static java.lang.annotation.ElementType.PARAMETER;
021import static java.lang.annotation.RetentionPolicy.RUNTIME;
022
023
024/**
025 * Annotation used with parameters of service builder methods to identify the service to be injected into the service
026 * builder method via the parameter. In many cases the {@link org.apache.tapestry5.ioc.annotations.Inject} annotation is
027 * more flexible or appropriate.
028 *
029 * This annotation may also be used with fields of service implementation classes, modules, or other objects constructed
030 * via <a href="https://tapestry.apache.org/current/apidocs/org/apache/tapestry5/commons/ObjectLocator.html#autobuild(Class)">ObjectLocator#autobuild(Class)</a>.
031 */
032@Target({PARAMETER, FIELD})
033@Retention(RUNTIME)
034@Documented
035@UseWith(AnnotationUseContext.SERVICE)
036public @interface InjectService
037{
038
039    /**
040     * The id of the service to inject; either a fully qualified id, or the unqualified id of a service within the same
041     * module.
042     */
043    String value();
044}