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.ElementType.TYPE;
021import static java.lang.annotation.RetentionPolicy.RUNTIME;
022
023/**
024 * Used to define one or more 
025 * <a href="https://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ioc/def/ServiceDef.html">ServiceDef#getMarkers() marker annotations</a> for a service implementation. This
026 * allows for injection based on the combination of type and marker interface. These marker interfaces should not have
027 * any values. The mere presence of the marker annotation is all that is needed.
028 *
029 * When applied to a module class, this sets the default markers for all services within the module.  Markers are
030 * additive, so a Marker annotation on the implementation class and/or specified with {@link
031 * org.apache.tapestry5.ioc.ServiceBindingOptions#withMarker(Class[])} will accumulate; a service may have any number of
032 * markers.  Generally one or two is enough.
033 *
034 * @see org.apache.tapestry5.commons.ObjectLocator#getService(Class, Class[])
035 */
036@Target(
037        {TYPE, METHOD})
038@Retention(RUNTIME)
039@Documented
040@UseWith({AnnotationUseContext.SERVICE, AnnotationUseContext.MODULE})
041public @interface Marker
042{
043    /**
044     * The type of annotation (which will be present at the injection point).
045     */
046    Class[] value();
047}