當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiClass.getMethods方法代碼示例

本文整理匯總了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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:24,代碼來源:StubBuilder.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:45,代碼來源:RenameResourceElementProcessor.java

示例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;
}
 
開發者ID:manifold-systems,項目名稱:manifold-ij,代碼行數:47,代碼來源:ResourceToManifoldUtil.java


注:本文中的com.intellij.psi.PsiClass.getMethods方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。