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


Java TypeInfo.create方法代码示例

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


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

示例1: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);

  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  boolean hasDocComment = false;
  String name = null;
  String initializer = null;

  boolean expectingInit = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      hasDocComment = true;
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaTokenType.EQ) {
      expectingInit = true;
    }
    else if (expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type != JavaTokenType.SEMICOLON) {
      initializer = encodeInitializer(tree, child);
      break;
    }
  }

  final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
  final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);

  return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:JavaFieldStubElementType.java

示例2: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
  LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
  String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JavaParameterElementType.java

示例3: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);

  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  String name = null;
  String initializer = null;

  boolean expectingInit = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaTokenType.EQ) {
      expectingInit = true;
    }
    else if (expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type != JavaTokenType.SEMICOLON) {
      initializer = encodeInitializer(tree, child);
      break;
    }
  }

  final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
  final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation);

  return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:JavaFieldStubElementType.java

示例4: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
  TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
  LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, ID_TYPES);
  String name = RecordUtil.intern(tree.getCharTable(), id);
  return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:JavaParameterElementType.java

示例5: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
	TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
	LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
	String name = RecordUtil.intern(tree.getCharTable(), id);
	return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis, false);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:JavaParameterElementType.java

示例6: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  String name = null;
  boolean isConstructor = true;
  boolean isVarArgs = false;
  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  boolean hasDocComment = false;
  String defValueText = null;

  boolean expectingDef = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      hasDocComment = true;
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaElementType.TYPE) {
      isConstructor = false;
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaElementType.PARAMETER_LIST) {
      final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
      if (!params.isEmpty()) {
        final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
        if (pType != null) {
          isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
        }
      }
    }
    else if (type == JavaTokenType.DEFAULT_KEYWORD) {
      expectingDef = true;
    }
    else if (expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
             type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK) {
      defValueText = LightTreeUtil.toFilteredString(tree, child, null);
      break;
    }
  }

  TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
  boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
  byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);

  return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:52,代码来源:JavaMethodElementType.java

示例7: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
  String name = null;
  boolean isConstructor = true;
  boolean isVarArgs = false;
  boolean isDeprecatedByComment = false;
  boolean hasDeprecatedAnnotation = false;
  String defValueText = null;

  boolean expectingDef = false;
  for (final LighterASTNode child : tree.getChildren(node)) {
    final IElementType type = child.getTokenType();
    if (type == JavaDocElementType.DOC_COMMENT) {
      isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
    }
    else if (type == JavaElementType.MODIFIER_LIST) {
      hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
    }
    else if (type == JavaElementType.TYPE) {
      isConstructor = false;
    }
    else if (type == JavaTokenType.IDENTIFIER) {
      name = RecordUtil.intern(tree.getCharTable(), child);
    }
    else if (type == JavaElementType.PARAMETER_LIST) {
      final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
      if (params.size() > 0) {
        final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
        if (pType != null) {
          isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
        }
      }
    }
    else if (type == JavaTokenType.DEFAULT_KEYWORD) {
      expectingDef = true;
    }
    else if (expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
             type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK) {
      defValueText = LightTreeUtil.toFilteredString(tree, child, null);
      break;
    }
  }

  TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
  boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
  byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation);

  return new PsiMethodStubImpl(parentStub, StringRef.fromString(name), typeInfo, flags, StringRef.fromString(defValueText));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:50,代码来源:JavaMethodElementType.java

示例8: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiMethodStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
	String name = null;
	boolean isConstructor = true;
	boolean isVarArgs = false;
	boolean isDeprecatedByComment = false;
	boolean hasDeprecatedAnnotation = false;
	boolean hasDocComment = false;
	String defValueText = null;

	boolean expectingDef = false;
	for(final LighterASTNode child : tree.getChildren(node))
	{
		final IElementType type = child.getTokenType();
		if(type == JavaDocElementType.DOC_COMMENT)
		{
			hasDocComment = true;
			isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
		}
		else if(type == JavaElementType.MODIFIER_LIST)
		{
			hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
		}
		else if(type == JavaElementType.TYPE)
		{
			isConstructor = false;
		}
		else if(type == JavaTokenType.IDENTIFIER)
		{
			name = RecordUtil.intern(tree.getCharTable(), child);
		}
		else if(type == JavaElementType.PARAMETER_LIST)
		{
			final List<LighterASTNode> params = LightTreeUtil.getChildrenOfType(tree, child, JavaElementType.PARAMETER);
			if(!params.isEmpty())
			{
				final LighterASTNode pType = LightTreeUtil.firstChildOfType(tree, params.get(params.size() - 1), JavaElementType.TYPE);
				if(pType != null)
				{
					isVarArgs = (LightTreeUtil.firstChildOfType(tree, pType, JavaTokenType.ELLIPSIS) != null);
				}
			}
		}
		else if(type == JavaTokenType.DEFAULT_KEYWORD)
		{
			expectingDef = true;
		}
		else if(expectingDef && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) &&
				type != JavaTokenType.SEMICOLON && type != JavaElementType.CODE_BLOCK)
		{
			defValueText = LightTreeUtil.toFilteredString(tree, child, null);
			break;
		}
	}

	TypeInfo typeInfo = isConstructor ? TypeInfo.createConstructorType() : TypeInfo.create(tree, node, parentStub);
	boolean isAnno = (node.getTokenType() == JavaElementType.ANNOTATION_METHOD);
	byte flags = PsiMethodStubImpl.packFlags(isConstructor, isAnno, isVarArgs, isDeprecatedByComment, hasDeprecatedAnnotation, hasDocComment);

	return new PsiMethodStubImpl(parentStub, name, typeInfo, flags, defValueText);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:63,代码来源:JavaMethodElementType.java

示例9: createStub

import com.intellij.psi.impl.cache.TypeInfo; //导入方法依赖的package包/类
@Override
public PsiFieldStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub)
{
	final TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);

	boolean isDeprecatedByComment = false;
	boolean hasDeprecatedAnnotation = false;
	boolean hasDocComment = false;
	String name = null;
	String initializer = null;

	boolean expectingInit = false;
	for(final LighterASTNode child : tree.getChildren(node))
	{
		final IElementType type = child.getTokenType();
		if(type == JavaDocElementType.DOC_COMMENT)
		{
			hasDocComment = true;
			isDeprecatedByComment = RecordUtil.isDeprecatedByDocComment(tree, child);
		}
		else if(type == JavaElementType.MODIFIER_LIST)
		{
			hasDeprecatedAnnotation = RecordUtil.isDeprecatedByAnnotation(tree, child);
		}
		else if(type == JavaTokenType.IDENTIFIER)
		{
			name = RecordUtil.intern(tree.getCharTable(), child);
		}
		else if(type == JavaTokenType.EQ)
		{
			expectingInit = true;
		}
		else if(expectingInit && !ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type) && type !=
				JavaTokenType.SEMICOLON)
		{
			initializer = encodeInitializer(tree, child);
			break;
		}
	}

	final boolean isEnumConst = node.getTokenType() == JavaElementType.ENUM_CONSTANT;
	final byte flags = PsiFieldStubImpl.packFlags(isEnumConst, isDeprecatedByComment, hasDeprecatedAnnotation,
			hasDocComment);

	return new PsiFieldStubImpl(parentStub, name, typeInfo, initializer, flags);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:47,代码来源:JavaFieldStubElementType.java


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