本文整理汇总了Java中com.intellij.psi.PsiClass.getMethods方法的典型用法代码示例。如果您正苦于以下问题:Java PsiClass.getMethods方法的具体用法?Java PsiClass.getMethods怎么用?Java PsiClass.getMethods使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiClass
的用法示例。
在下文中一共展示了PsiClass.getMethods方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeSrcClass
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
public SrcClass makeSrcClass( String fqn, PsiClass psiClass, ManModule module )
{
SrcClass srcClass = new SrcClass( fqn, getKind( psiClass ) )
.modifiers( getModifiers( psiClass.getModifierList() ) );
for( PsiTypeParameter typeVar : psiClass.getTypeParameters() )
{
srcClass.addTypeVar( new SrcType( makeTypeVar( typeVar ) ) );
}
setSuperTypes( srcClass, psiClass );
for( PsiMethod psiMethod : psiClass.getMethods() )
{
addMethod( srcClass, psiMethod );
}
for( PsiField psiField : psiClass.getFields() )
{
addField( srcClass, psiField );
}
for( PsiClass psiInnerClass : psiClass.getInnerClasses() )
{
addInnerClass( srcClass, psiInnerClass, module );
}
return srcClass;
}
示例2: findFeatureElement
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private PsiNamedElement findFeatureElement( PsiClass psiClass, FeaturePath child )
{
if( child == null )
{
return psiClass;
}
PsiNamedElement result = null;
switch( child.getFeatureType() )
{
case Class:
{
PsiClass[] innerClasses = psiClass.getInnerClasses();
if( innerClasses.length == child.getCount() )
{
result = findFeatureElement( innerClasses[child.getIndex()], child.getChild() );
}
break;
}
case Method:
{
PsiMethod[] methods = psiClass.getMethods();
if( methods.length == child.getCount() )
{
result = methods[child.getIndex()];
}
break;
}
case Field:
PsiField[] fields = psiClass.getFields();
if( fields.length == child.getCount() )
{
result = fields[child.getIndex()];
}
break;
default:
throw new IllegalStateException( "Unhandled feature type: " + child.getFeatureType() );
}
return result;
}
示例3: findJavaElementsFor
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private static List<PsiElement> findJavaElementsFor( PsiClass psiClass, PsiElement element, FeaturePath parent )
{
List<PsiElement> result = new ArrayList<>();
if( isJavaElementFor( psiClass, element ) )
{
result.add( psiClass );
psiClass.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Class, 0, 1 ) );
}
PsiMethod[] methods = psiClass.getMethods();
for( int i = 0; i < methods.length; i++ )
{
PsiMethod method = methods[i];
if( isJavaElementFor( method, element ) ||
element instanceof PsiClass && isJavaElementForType( method, (PsiClass)element ) )
{
result.add( method );
method.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Method, i, methods.length ) );
}
}
PsiField[] fields = psiClass.getFields();
for( int i = 0; i < fields.length; i++ )
{
PsiField field = fields[i];
if( isJavaElementFor( field, element ) ||
element instanceof PsiClass && isJavaElementForType( field, (PsiClass)element ) )
{
result.add( field );
field.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Field, i, fields.length ) );
}
}
PsiClass[] inners = psiClass.getInnerClasses();
for( int i = 0; i < inners.length; i++ )
{
PsiClass inner = inners[i];
if( isJavaElementFor( inner, element ) ||
element instanceof PsiClass && isJavaElementForType( inner, (PsiClass)element ) )
{
result.add( inner );
inner.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Class, i, inners.length ) );
}
result.addAll( findJavaElementsFor( inner, element, new FeaturePath( parent, FeaturePath.FeatureType.Class, i, inners.length ) ) );
}
return result;
}