blob: 634b491854b31c6e3955465c48d772753c2c67c5 [file] [log] [blame]
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.psi.stubs;
import com.intellij.lang.Language;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
/**
* @author peter
*/
public abstract class EmptyStubElementType<T extends PsiElement> extends IStubElementType<EmptyStub, T> {
protected EmptyStubElementType(@NotNull @NonNls String debugName, @Nullable Language language) {
super(debugName, language);
}
@Override
public final EmptyStub createStub(@NotNull T psi, StubElement parentStub) {
return createStub(parentStub);
}
protected EmptyStub createStub(StubElement parentStub) {
return new EmptyStub(parentStub, this);
}
@NotNull
@Override
public String getExternalId() {
return getLanguage().getID() + toString();
}
@Override
public final void serialize(@NotNull EmptyStub stub, @NotNull StubOutputStream dataStream) throws IOException {
}
@NotNull
@Override
public final EmptyStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
return createStub(parentStub);
}
@Override
public final void indexStub(@NotNull EmptyStub stub, @NotNull IndexSink sink) {
}
}