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