Java 类com.intellij.psi.impl.java.stubs.impl.PsiClassStubImpl 实例源码

项目:intellij-ce-playground    文件:JavaClassElementType.java   
@NotNull
@Override
public PsiClassStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
  byte flags = dataStream.readByte();
  boolean isAnonymous = PsiClassStubImpl.isAnonymous(flags);
  boolean isEnumConst = PsiClassStubImpl.isEnumConstInitializer(flags);
  JavaClassElementType type = typeForClass(isAnonymous, isEnumConst);

  if (!isAnonymous) {
    StringRef name = dataStream.readName();
    StringRef qname = dataStream.readName();
    int languageLevelId = dataStream.readByte();
    StringRef sourceFileName = dataStream.readName();
    PsiClassStubImpl classStub = new PsiClassStubImpl(type, parentStub, qname, name, null, flags);
    classStub.setLanguageLevel(LanguageLevel.values()[languageLevelId]);
    classStub.setSourceFileName(sourceFileName);
    return classStub;
  }
  else {
    StringRef baseRef = dataStream.readName();
    return new PsiClassStubImpl(type, parentStub, null, null, baseRef, flags);
  }
}
项目:tools-idea    文件:JavaClassElementType.java   
@NotNull
@Override
public PsiClassStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
  byte flags = dataStream.readByte();
  boolean isAnonymous = PsiClassStubImpl.isAnonymous(flags);
  boolean isEnumConst = PsiClassStubImpl.isEnumConstInitializer(flags);
  JavaClassElementType type = typeForClass(isAnonymous, isEnumConst);

  if (!isAnonymous) {
    StringRef name = dataStream.readName();
    StringRef qname = dataStream.readName();
    int languageLevelId = dataStream.readByte();
    StringRef sourceFileName = dataStream.readName();
    PsiClassStubImpl classStub = new PsiClassStubImpl(type, parentStub, qname, name, null, flags);
    classStub.setLanguageLevel(LanguageLevel.values()[languageLevelId]);
    classStub.setSourceFileName(sourceFileName);
    return classStub;
  }
  else {
    StringRef baseRef = dataStream.readName();
    return new PsiClassStubImpl(type, parentStub, null, null, baseRef, flags);
  }
}
项目:consulo-java    文件:JavaClassElementType.java   
@NotNull
@Override
public PsiClassStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException
{
    byte flags = dataStream.readByte();
    boolean isAnonymous = PsiClassStubImpl.isAnonymous(flags);

    if(!isAnonymous)
    {
        StringRef name = dataStream.readName();
        StringRef qname = dataStream.readName();
        StringRef sourceFileName = dataStream.readName();
        PsiClassStubImpl classStub = new PsiClassStubImpl(this, parentStub, StringRef.toString(qname), StringRef.toString(name), null, flags);
        classStub.setSourceFileName(StringRef.toString(sourceFileName));
        return classStub;
    }
    else
    {
        StringRef baseRef = dataStream.readName();
        return new PsiClassStubImpl(this, parentStub, null, null, StringRef.toString(baseRef), flags);
    }
}
项目:intellij-ce-playground    文件:JavaClassElementType.java   
@Override
public void serialize(@NotNull final PsiClassStub stub, @NotNull final StubOutputStream dataStream) throws IOException {
  dataStream.writeByte(((PsiClassStubImpl)stub).getFlags());
  if (!stub.isAnonymous()) {
    dataStream.writeName(stub.getName());
    dataStream.writeName(stub.getQualifiedName());
    dataStream.writeByte(stub.getLanguageLevel().ordinal());
    dataStream.writeName(stub.getSourceFileName());
  }
  else {
    dataStream.writeName(stub.getBaseClassReferenceText());
  }
}
项目:tools-idea    文件:JavaClassElementType.java   
@Override
public void serialize(@NotNull final PsiClassStub stub, @NotNull final StubOutputStream dataStream) throws IOException {
  dataStream.writeByte(((PsiClassStubImpl)stub).getFlags());
  if (!stub.isAnonymous()) {
    dataStream.writeName(stub.getName());
    dataStream.writeName(stub.getQualifiedName());
    dataStream.writeByte(stub.getLanguageLevel().ordinal());
    dataStream.writeName(stub.getSourceFileName());
  }
  else {
    dataStream.writeName(stub.getBaseClassReferenceText());
  }
}
项目:consulo-java    文件:JavaClassElementType.java   
@Override
public void serialize(@NotNull PsiClassStub stub, @NotNull StubOutputStream dataStream) throws IOException
{
    dataStream.writeByte(((PsiClassStubImpl) stub).getFlags());
    if(!stub.isAnonymous())
    {
        dataStream.writeName(stub.getName());
        dataStream.writeName(stub.getQualifiedName());
        dataStream.writeName(stub.getSourceFileName());
    }
    else
    {
        dataStream.writeName(stub.getBaseClassReferenceText());
    }
}
项目:consulo-javaee    文件:JspClassStubElementType.java   
@Override
public PsiClassStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
    String qualifiedName = null;
    String name = null;

    if(parentStub instanceof PsiFileStub)
    {
        PsiElement psi = parentStub.getPsi();
        if(psi instanceof PsiFile)
        {
            name = JspClassImpl.buildName((PsiFile) psi);
        }
    }

    if(name != null)
    {
        if(parentStub instanceof PsiJavaFileStub)
        {
            final String pkg = ((PsiJavaFileStub) parentStub).getPackageName();
            if(!pkg.isEmpty())
            {
                qualifiedName = pkg + '.' + name;
            }
            else
            {
                qualifiedName = name;
            }
        }
        else if(parentStub instanceof PsiClassStub)
        {
            final String parentFqn = ((PsiClassStub) parentStub).getQualifiedName();
            qualifiedName = parentFqn != null ? parentFqn + '.' + name : null;
        }
        else if(parentStub instanceof PsiClassLevelDeclarationStatementStub)
        {
            StubElement parent = parentStub;
            while(parent != null)
            {
                if(parent instanceof PsiClassStub)
                {
                    qualifiedName = ((PsiClassStub) parent).getQualifiedName();
                    break;
                }
                parent = parent.getParentStub();
            }
        }
    }

    return new PsiClassStubImpl(this, parentStub, qualifiedName, name, null, (byte) 0);
}