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.*;
016
017/**
018 * Marks a service as not eligible for decoration. This is useful for services that, if decorated, can cause cycle
019 * dependency errors; for example, {@link org.apache.tapestry5.ioc.services.MasterObjectProvider}, or services
020 * <em>contributed to</em> MasterObjectProvider, are good candidates for this annotation.
021 *
022 * The annotation can be applied to service implementation class or to a service builder method in a module class.
023 *
024 * The annotation may also be placed on a module class, to indicate that all services defined for the module should not
025 * allow decoration.
026 *
027 * Service decoration includes the decoration mechanism (from Tapestry 5.0) and the newer service advice mechanism (from
028 * Tapestry 5.1).
029 *
030 * Generally, services that are used to advise or decorate other services (such as {@link org.apache.tapestry5.ioc.services.LoggingAdvisor}
031 * or {@link org.apache.tapestry5.ioc.services.OperationAdvisor}) should include this annotation, to prevent a recursive service build
032 * when they attempt to advise themselves.
033 *
034 * @see org.apache.tapestry5.ioc.def.ServiceDef2#isPreventDecoration()
035 * @since 5.1.0.0
036 */
037@Target({ElementType.TYPE, ElementType.METHOD})
038@Retention(RetentionPolicy.RUNTIME)
039@Documented
040@UseWith(AnnotationUseContext.SERVICE)
041public @interface PreventServiceDecoration
042{
043}