Refactoring - new interface for common method
This commit is contained in:
@@ -30,11 +30,13 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetClassBody extends JetElement {
|
||||
public class JetClassBody extends JetElement implements JetDeclarationContainer {
|
||||
public JetClassBody(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<JetDeclaration> getDeclarations() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public interface JetClassOrObject extends PsiElement, PsiNameIdentifierOwner {
|
||||
List<JetDeclaration> getDeclarations();
|
||||
|
||||
public interface JetClassOrObject extends PsiElement, PsiNameIdentifierOwner, JetDeclarationContainer {
|
||||
@Nullable
|
||||
JetDelegationSpecifierList getDelegationSpecifierList();
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2012 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 org.jetbrains.jet.lang.psi;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Nikolay Krasko
|
||||
*/
|
||||
public interface JetDeclarationContainer {
|
||||
@NotNull
|
||||
List<JetDeclaration> getDeclarations();
|
||||
}
|
||||
@@ -33,11 +33,12 @@ import org.jetbrains.jet.plugin.JetLanguage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JetFile extends PsiFileBase {
|
||||
public class JetFile extends PsiFileBase implements JetDeclarationContainer {
|
||||
public JetFile(FileViewProvider viewProvider) {
|
||||
super(viewProvider, JetLanguage.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileType getFileType() {
|
||||
return JetFileType.INSTANCE;
|
||||
@@ -48,6 +49,8 @@ public class JetFile extends PsiFileBase {
|
||||
return "JetFile: " + getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetDeclaration> getDeclarations() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,13 @@ import java.util.List;
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JetNamespaceBody extends JetElement {
|
||||
public class JetNamespaceBody extends JetElement implements JetDeclarationContainer {
|
||||
public JetNamespaceBody(@NotNull ASTNode node) {
|
||||
super(node);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<JetDeclaration> getDeclarations() {
|
||||
return PsiTreeUtil.getChildrenOfTypeAsList(this, JetDeclaration.class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user