update copyright
[fedora-idea.git] / java / java-impl / src / com / intellij / psi / impl / java / stubs / impl / PsiJavaFileStubImpl.java
blobe70d5f9046bebc58f5cd0e1a2bd13a17ea76c565
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.
18 * @author max
20 package com.intellij.psi.impl.java.stubs.impl;
22 import com.intellij.psi.PsiJavaFile;
23 import com.intellij.psi.PsiClass;
24 import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
25 import com.intellij.psi.impl.java.stubs.PsiJavaFileStub;
26 import com.intellij.psi.stubs.PsiFileStubImpl;
27 import com.intellij.psi.tree.IStubFileElementType;
28 import com.intellij.util.io.StringRef;
30 public class PsiJavaFileStubImpl extends PsiFileStubImpl<PsiJavaFile> implements PsiJavaFileStub {
31 private StringRef myPackageName;
32 private final boolean myCompiled;
34 public PsiJavaFileStubImpl(final PsiJavaFile file, boolean compiled) {
35 super(file);
36 myPackageName = StringRef.fromString(file.getPackageName());
37 myCompiled = compiled;
40 public PsiJavaFileStubImpl(final String packageName, boolean compiled) {
41 this(StringRef.fromString(packageName), compiled);
44 public PsiJavaFileStubImpl(final StringRef packageName, boolean compiled) {
45 super(null);
46 myPackageName = packageName;
47 myCompiled = compiled;
50 public String getPackageName() {
51 return StringRef.toString(myPackageName);
54 public boolean isCompiled() {
55 return myCompiled;
58 public void setPackageName(final String packageName) {
59 myPackageName = StringRef.fromString(packageName);
62 public IStubFileElementType getType() {
63 return JavaStubElementTypes.FILE;
66 @SuppressWarnings({"HardCodedStringLiteral"})
67 public String toString() {
68 return "PsiJavaFileStub [" + myPackageName + "]";
71 public PsiClass[] getClasses() {
72 return getChildrenByType(JavaStubElementTypes.CLASS, PsiClass.ARRAY_FACTORY);