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.METHOD; 020import static java.lang.annotation.RetentionPolicy.RUNTIME; 021 022/** 023 * Optional, but typically used, annotation for service decorator methods, used to define which services the decorator 024 * applies to. This annotation defines a number of <em>patterns</em> that allow services across multiple modules to be 025 * selected. A decorator is applied to a service if any of its patterns match the service. 026 * 027 * TODO: Describe pattern glob-match syntax 028 * 029 * When the Match annotation is not supplied, then the decorator only applies to a single service: the service whose id 030 * matches the decorators id; that is, method <code>decorateMyService()</code> would decorate only the service provided 031 * by the <code>buildMyService()</code> method, within the same module. 032 */ 033@Target(METHOD) 034@Retention(RUNTIME) 035@Documented 036@UseWith(AnnotationUseContext.SERVICE_DECORATOR) 037public @interface Match 038{ 039 040 /** 041 * Defines a list of patterns matched against potential service ids to identify to which services the decorator 042 * applies. A decorator is applied if <em>any</em> of the patterns match. 043 */ 044 String[] value(); 045}