2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com.intellij.psi;
18 import org.jetbrains.annotations.NotNull;
19 import org.jetbrains.annotations.Nullable;
20 import org.jetbrains.annotations.NonNls;
25 public interface PsiAnnotationOwner {
27 * Returns the list of annotations syntactically contained in the element.
29 * @return the list of annotations.
32 PsiAnnotation[] getAnnotations();
36 * @return the list of annotations which are applicable to this owner.
37 * E.g. Type annotations on method belong to its type element, not the method.
39 @NotNull PsiAnnotation[] getApplicableAnnotations();
42 * Searches the modifier list for an annotation with the specified fully qualified name
43 * and returns one if it is found.
45 * @param qualifiedName the fully qualified name of the annotation to find.
46 * @return the annotation instance, or null if no such annotation is found.
49 PsiAnnotation findAnnotation(@NotNull @NonNls String qualifiedName);
52 * Add a new annotation to this modifier list. The annotation class name will be shortened. No attribbutes will be defined.
53 * @param qualifiedName qualifiedName
54 * @return newly added annotation
57 PsiAnnotation addAnnotation(@NotNull @NonNls String qualifiedName);