jaroslav@68: /* jaroslav@68: * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. jaroslav@68: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@68: * jaroslav@68: * This code is free software; you can redistribute it and/or modify it jaroslav@68: * under the terms of the GNU General Public License version 2 only, as jaroslav@68: * published by the Free Software Foundation. Oracle designates this jaroslav@68: * particular file as subject to the "Classpath" exception as provided jaroslav@68: * by Oracle in the LICENSE file that accompanied this code. jaroslav@68: * jaroslav@68: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@68: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@68: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@68: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@68: * accompanied this code). jaroslav@68: * jaroslav@68: * You should have received a copy of the GNU General Public License version jaroslav@68: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@68: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@68: * jaroslav@68: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@68: * or visit www.oracle.com if you need additional information or have any jaroslav@68: * questions. jaroslav@68: */ jaroslav@68: jaroslav@68: package java.lang.annotation; jaroslav@68: jaroslav@68: /** jaroslav@68: * Indicates the kinds of program element to which an annotation type jaroslav@68: * is applicable. If a Target meta-annotation is not present on an jaroslav@68: * annotation type declaration, the declared type may be used on any jaroslav@68: * program element. If such a meta-annotation is present, the compiler jaroslav@68: * will enforce the specified usage restriction. jaroslav@68: * jaroslav@68: * For example, this meta-annotation indicates that the declared type is jaroslav@68: * itself a meta-annotation type. It can only be used on annotation type jaroslav@68: * declarations: jaroslav@68: *
jaroslav@68:  *    @Target(ElementType.ANNOTATION_TYPE)
jaroslav@68:  *    public @interface MetaAnnotationType {
jaroslav@68:  *        ...
jaroslav@68:  *    }
jaroslav@68:  * 
jaroslav@68: * This meta-annotation indicates that the declared type is intended solely jaroslav@68: * for use as a member type in complex annotation type declarations. It jaroslav@68: * cannot be used to annotate anything directly: jaroslav@68: *
jaroslav@68:  *    @Target({})
jaroslav@68:  *    public @interface MemberType {
jaroslav@68:  *        ...
jaroslav@68:  *    }
jaroslav@68:  * 
jaroslav@68: * It is a compile-time error for a single ElementType constant to jaroslav@68: * appear more than once in a Target annotation. For example, the jaroslav@68: * following meta-annotation is illegal: jaroslav@68: *
jaroslav@68:  *    @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
jaroslav@68:  *    public @interface Bogus {
jaroslav@68:  *        ...
jaroslav@68:  *    }
jaroslav@68:  * 
jaroslav@68: */ jaroslav@68: @Documented jaroslav@68: @Retention(RetentionPolicy.RUNTIME) jaroslav@68: @Target(ElementType.ANNOTATION_TYPE) jaroslav@68: public @interface Target { jaroslav@68: ElementType[] value(); jaroslav@68: }