当前位置: 首页>>代码示例>>Java>>正文


Java PsiClass.isInterface方法代码示例

本文整理汇总了Java中com.intellij.psi.PsiClass.isInterface方法的典型用法代码示例。如果您正苦于以下问题:Java PsiClass.isInterface方法的具体用法?Java PsiClass.isInterface怎么用?Java PsiClass.isInterface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.PsiClass的用法示例。


在下文中一共展示了PsiClass.isInterface方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getKind

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private SrcClass.Kind getKind( PsiClass psiClass )
{
  if( psiClass.isInterface() )
  {
    return SrcClass.Kind.Interface;
  }
  if( psiClass.isAnnotationType() )
  {
    return SrcClass.Kind.Annotation;
  }
  if( psiClass.isEnum() )
  {
    return SrcClass.Kind.Enum;
  }
  return SrcClass.Kind.Class;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:17,代码来源:StubBuilder.java

示例2: InterfaceNode

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
public InterfaceNode(SeedStackSimpleNode parent, PsiClass psiInterface) {
    super(parent);
    if (!psiInterface.isInterface()) {
        throw new IllegalArgumentException("PsiClass " + psiInterface + " is not an interface");
    }
    this.psiInterface = psiInterface;
    setIcon(getInterfaceIcon());
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:9,代码来源:InterfaceNode.java

示例3: addMethods

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private void addMethods( String fqn, PsiClass psiClass, List<PsiElement> augFeatures, Module start, Module module )
{
  ManModule manModule = ManProject.getModule( module );
  for( ITypeManifold sp : manModule.getTypeManifolds() )
  {
    if( sp.getProducerKind() == Supplemental )
    {
      if( sp.isType( fqn ) )
      {
        List<IFile> files = sp.findFilesForType( fqn );
        for( IFile file : files )
        {
          VirtualFile vFile = ((IjFile)file).getVirtualFile();
          if( !vFile.isValid() )
          {
            continue;
          }

          PsiFile psiFile = PsiManager.getInstance( module.getProject() ).findFile( vFile );
          PsiJavaFile psiJavaFile = (PsiJavaFile)psiFile;
          PsiClass[] classes = psiJavaFile.getClasses();
          if( classes.length > 0 )
          {
            SrcClass srcExtClass = new StubBuilder().make( classes[0].getQualifiedName(), manModule );
            SrcClass scratchClass = new SrcClass( psiClass.getQualifiedName(), psiClass.isInterface() ? SrcClass.Kind.Interface : SrcClass.Kind.Class );
            for( PsiTypeParameter tv : psiClass.getTypeParameters() )
            {
              scratchClass.addTypeVar( new SrcType( StubBuilder.makeTypeVar( tv ) ) );
            }
            for( AbstractSrcMethod m : srcExtClass.getMethods() )
            {
              SrcMethod srcMethod = addExtensionMethod( scratchClass, m, psiClass );
              if( srcMethod != null )
              {
                PsiMethod extMethod = makePsiMethod( srcMethod, psiClass );
                if( extMethod != null )
                {
                  PsiMethod plantedMethod = plantMethodInPsiClass( extMethod, psiClass, classes[0] );
                  augFeatures.add( plantedMethod );
                }
              }
            }
          }
        }
      }
    }
  }
  for( Dependency d : manModule.getDependencies() )
  {
    if( module == start || d.isExported() )
    {
      addMethods( fqn, psiClass, augFeatures, start, ((ManModule)d.getModule()).getIjModule() );
    }
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:56,代码来源:ManAugmentProvider.java

示例4: addExtensionMethod

import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private SrcMethod addExtensionMethod( SrcClass srcClass, AbstractSrcMethod method, PsiClass extendedType )
{
  if( !isExtensionMethod( method, extendedType.getQualifiedName() ) )
  {
    return null;
  }

  SrcMethod srcMethod = new SrcMethod( srcClass );
  long modifiers = method.getModifiers();

  boolean isInstanceExtensionMethod = isInstanceExtensionMethod( method, extendedType.getQualifiedName() );

  if( extendedType.isInterface() && isInstanceExtensionMethod )
  {
    // extension method must be default method in interface to not require implementation
    modifiers |= 0x80000000000L; //Flags.DEFAULT;
  }

  if( isInstanceExtensionMethod )
  {
    // remove static
    modifiers &= ~Modifier.STATIC;
  }
  srcMethod.modifiers( modifiers );

  srcMethod.returns( method.getReturnType() );

  String name = method.getSimpleName();
  srcMethod.name( name );

  @SuppressWarnings("unchecked")
  List<SrcType> typeParams = method.getTypeVariables();

  // extension method must reflect extended type's type vars before its own
  int extendedTypeVarCount = extendedType.getTypeParameterList().getTypeParameters().length;
  for( int i = isInstanceExtensionMethod ? extendedTypeVarCount : 0; i < typeParams.size(); i++ )
  {
    SrcType typeVar = typeParams.get( i );
    srcMethod.addTypeVar( typeVar );
  }

  @SuppressWarnings("unchecked")
  List<SrcParameter> params = method.getParameters();

  for( int i = isInstanceExtensionMethod ? 1 : 0; i < params.size(); i++ )
  {
    // exclude This param

    SrcParameter param = params.get( i );
    srcMethod.addParam( param.getSimpleName(), param.getType() );
  }

  for( Object throwType : method.getThrowTypes() )
  {
    srcMethod.addThrowType( (SrcType)throwType );
  }

  srcMethod.body( new SrcStatementBlock()
                    .addStatement(
                      new SrcRawStatement()
                        .rawText( "throw new RuntimeException();" ) ) );

  //srcClass.addMethod( srcMethod );
  return srcMethod;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:66,代码来源:ManAugmentProvider.java


注:本文中的com.intellij.psi.PsiClass.isInterface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。