update copyright
[fedora-idea.git] / java / openapi / src / com / intellij / psi / PsiImportList.java
blobca869ade55417508429607e92cd6b75d3e162f1c
1 /*
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 com.intellij.util.ArrayFactory;
19 import org.jetbrains.annotations.NonNls;
20 import org.jetbrains.annotations.NotNull;
21 import org.jetbrains.annotations.Nullable;
23 /**
24 * Represents the list of import statements contained in a Java or JSP file.
26 * @see PsiJavaFile#getImportList()
28 public interface PsiImportList extends PsiElement {
29 PsiImportList[] EMPTY_ARRAY = new PsiImportList[0];
30 ArrayFactory<PsiImportList> ARRAY_FACTORY = new ArrayFactory<PsiImportList>() {
31 public PsiImportList[] create(int count) {
32 return count == 0 ? EMPTY_ARRAY : new PsiImportList[count];
36 /**
37 * Returns the non-static import statements contained in the list.
39 * @return the array of non-static import statements.
41 @NotNull PsiImportStatement[] getImportStatements();
43 /**
44 * Returns the static import statements contained in the list.
46 * @return the array of static import statements.
48 @NotNull PsiImportStaticStatement[] getImportStaticStatements();
50 /**
51 * Returns all import statements contained in the list.
53 * @return the array of import statements.
55 @NotNull PsiImportStatementBase[] getAllImportStatements();
57 /**
58 * Searches the list for a single-class import statement importing the specified class.
60 * @param qName the full-qualified name of the imported class.
61 * @return the import statement, or null if one was not found.
63 @Nullable
64 PsiImportStatement findSingleClassImportStatement(String qName);
66 /**
67 * Searches the list for an on-demand import statement importing the specified class.
69 * @param packageName the name of the imported package.
70 * @return the import statement, or null if one was not found.
72 @Nullable
73 PsiImportStatement findOnDemandImportStatement(@NonNls String packageName);
75 /**
76 * Searches the list for a single import or import static statement importing the specified
77 * identifier.
79 * @param name the name of the imported class or method.
80 * @return the import statement, or null if one was not found.
82 @Nullable
83 PsiImportStatementBase findSingleImportStatement(String name);
85 /**
86 * Checks if replacing this import list with the specified import list will cause no
87 * modifications to the file.
89 * @param otherList the list to check possibility to replace with.
90 * @return true if replacing will not cause modifications; false otherwise.
92 boolean isReplaceEquivalent(PsiImportList otherList);