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


Java PsiFieldStub类代码示例

本文整理汇总了Java中com.intellij.psi.impl.java.stubs.PsiFieldStub的典型用法代码示例。如果您正苦于以下问题:Java PsiFieldStub类的具体用法?Java PsiFieldStub怎么用?Java PsiFieldStub使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsiFieldStub类属于com.intellij.psi.impl.java.stubs包,在下文中一共展示了PsiFieldStub类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ClsFieldImpl

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
public ClsFieldImpl(@NotNull PsiFieldStub stub) {
  super(stub);
  myType = new AtomicNotNullLazyValue<PsiTypeElement>() {
    @NotNull
    @Override
    protected PsiTypeElement compute() {
      PsiFieldStub stub = getStub();
      String typeText = TypeInfo.createTypeText(stub.getType(false));
      assert typeText != null : stub;
      return new ClsTypeElementImpl(ClsFieldImpl.this, typeText, ClsTypeElementImpl.VARIANCE_NONE);
    }
  };
  myInitializer = new VolatileNullableLazyValue<PsiExpression>() {
    @Nullable
    @Override
    protected PsiExpression compute() {
      String initializerText = getStub().getInitializerText();
      return initializerText != null && !Comparing.equal(PsiFieldStub.INITIALIZER_TOO_LONG, initializerText) ?
             ClsParsingUtil.createExpressionFromText(initializerText, getManager(), ClsFieldImpl.this) : null;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ClsFieldImpl.java

示例2: getType

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
@NotNull
public PsiType getType() {
  final PsiFieldStub stub = getStub();
  if (stub != null) {
    PsiType type = SoftReference.dereference(myCachedType);
    if (type != null) return type;

    String typeText = TypeInfo.createTypeText(stub.getType(true));
    try {
      type = JavaPsiFacade.getInstance(getProject()).getParserFacade().createTypeFromText(typeText, this);
      myCachedType = new SoftReference<PsiType>(type);
      return type;
    }
    catch (IncorrectOperationException e) {
      LOG.error(e);
      return null;
    }
  }

  myCachedType = null;
  return JavaSharedImplUtil.getType(getTypeElement(), getNameIdentifier());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PsiFieldImpl.java

示例3: getDocComment

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
public PsiDocComment getDocComment(){
  final PsiFieldStub stub = getStub();
  if (stub != null && !stub.hasDocComment()) return null;

  CompositeElement treeElement = getNode();
  if (getTypeElement() != null) {
    PsiElement element = treeElement.findChildByRoleAsPsiElement(ChildRole.DOC_COMMENT);
    return element instanceof PsiDocComment ? (PsiDocComment)element : null;
  }
  else {
    ASTNode prevField = treeElement.getTreePrev();
    while(prevField.getElementType() != JavaElementType.FIELD){
      prevField = prevField.getTreePrev();
    }
    return ((PsiField)SourceTreeToPsiMap.treeElementToPsi(prevField)).getDocComment();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:PsiFieldImpl.java

示例4: visitField

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
@Nullable
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value)
{
	if(isSet(access, Opcodes.ACC_SYNTHETIC))
	{
		return null;
	}
	if(name == null)
	{
		return null;
	}

	byte flags = PsiFieldStubImpl.packFlags(isSet(access, Opcodes.ACC_ENUM), isSet(access, Opcodes.ACC_DEPRECATED), false, false);
	TypeInfo type = fieldType(desc, signature);
	String initializer = constToString(value, type.text, false, myMapping);
	PsiFieldStub stub = new PsiFieldStubImpl(myResult, name, type, initializer, flags);
	PsiModifierListStub modList = new PsiModifierListStubImpl(stub, packFieldFlags(access));
	return new FieldAnnotationCollectingVisitor(modList, myMapping);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:StubBuildingVisitor.java

示例5: isStaticNonPrivateMember

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
public static boolean isStaticNonPrivateMember(@NotNull StubElement<?> stub)
{
	StubElement<PsiModifierList> type = stub.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
	if(!(type instanceof PsiModifierListStub))
	{
		return false;
	}

	int mask = ((PsiModifierListStub) type).getModifiersMask();
	if(ModifierFlags.hasModifierProperty(PsiModifier.PRIVATE, mask))
	{
		return false;
	}

	if(ModifierFlags.hasModifierProperty(PsiModifier.STATIC, mask))
	{
		return true;
	}

	return stub instanceof PsiFieldStub && stub.getStubType() == JavaElementType.ENUM_CONSTANT || stub.getParentStub() instanceof PsiClassStub && ((PsiClassStub) stub.getParentStub()).isInterface();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:22,代码来源:RecordUtil.java

示例6: getDetachedInitializer

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
public PsiExpression getDetachedInitializer()
{
	final PsiFieldStub stub = getGreenStub();
	PsiExpression initializer;
	if(stub == null)
	{
		initializer = getInitializer();
	}
	else
	{
		String initializerText = stub.getInitializerText();

		if(StringUtil.isEmpty(initializerText) || PsiFieldStub.INITIALIZER_NOT_STORED.equals(initializerText) || PsiFieldStub.INITIALIZER_TOO_LONG.equals(initializerText))
		{
			initializer = getInitializer();
		}
		else
		{
			PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(getProject()).getParserFacade();
			initializer = parserFacade.createExpressionFromText(initializerText, this);
			((LightVirtualFile) initializer.getContainingFile().getViewProvider().getVirtualFile()).setWritable(false);
		}
	}

	return initializer;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:PsiFieldImpl.java

示例7: getDocComment

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
public PsiDocComment getDocComment()
{
	final PsiFieldStub stub = getGreenStub();
	if(stub != null && !stub.hasDocComment())
	{
		return null;
	}

	CompositeElement treeElement = getNode();
	if(getTypeElement() != null)
	{
		PsiElement element = treeElement.findChildByRoleAsPsiElement(ChildRole.DOC_COMMENT);
		return element instanceof PsiDocComment ? (PsiDocComment) element : null;
	}
	else
	{
		ASTNode prevField = treeElement.getTreePrev();
		while(prevField.getElementType() != JavaElementType.FIELD)
		{
			prevField = prevField.getTreePrev();
		}
		return ((PsiField) SourceTreeToPsiMap.treeElementToPsi(prevField)).getDocComment();
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:PsiFieldImpl.java

示例8: getName

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
@NotNull
public String getName() {
  final PsiFieldStub stub = getStub();
  if (stub != null) {
    return stub.getName();
  }
  return getNameIdentifier().getText();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiEnumConstantImpl.java

示例9: isDeprecated

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
public boolean isDeprecated() {
  final PsiFieldStub stub = getStub();
  if (stub != null) {
    return stub.isDeprecated();
  }

  PsiDocComment docComment = getDocComment();
  return docComment != null && docComment.findTagByName("deprecated") != null ||
         getModifierList().findAnnotation("java.lang.Deprecated") != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiEnumConstantImpl.java

示例10: hasInitializer

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
public boolean hasInitializer() {
  PsiFieldStub stub = getStub();
  if (stub != null) {
    return stub.getInitializerText() != null;
  }

  return getInitializer() != null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiFieldImpl.java

示例11: isDeprecated

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
public boolean isDeprecated() {
  final PsiFieldStub stub = getStub();
  if (stub != null) {
    return stub.isDeprecated() || stub.hasDeprecatedAnnotation() && PsiImplUtil.isDeprecatedByAnnotation(this);
  }

  return PsiImplUtil.isDeprecatedByDocTag(this) || PsiImplUtil.isDeprecatedByAnnotation(this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiFieldImpl.java

示例12: ClsFieldImpl

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
public ClsFieldImpl(@NotNull PsiFieldStub stub)
{
	super(stub);
	myTypeElement = new AtomicNotNullLazyValue<PsiTypeElement>()
	{
		@NotNull
		@Override
		protected PsiTypeElement compute()
		{
			PsiFieldStub stub = getStub();
			String typeText = TypeInfo.createTypeText(stub.getType(false));
			assert typeText != null : stub;
			return new ClsTypeElementImpl(ClsFieldImpl.this, typeText, ClsTypeElementImpl.VARIANCE_NONE);
		}
	};
	myInitializer = new VolatileNullableLazyValue<PsiExpression>()
	{
		@Nullable
		@Override
		protected PsiExpression compute()
		{
			String initializerText = getStub().getInitializerText();
			return initializerText != null && !Comparing.equal(PsiFieldStub.INITIALIZER_TOO_LONG, initializerText) ? ClsParsingUtil.createExpressionFromText(initializerText, getManager(),
					ClsFieldImpl.this) : null;
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:28,代码来源:ClsFieldImpl.java

示例13: getName

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
@NotNull
public String getName()
{
	final PsiFieldStub stub = getStub();
	if(stub != null)
	{
		return stub.getName();
	}
	return getNameIdentifier().getText();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:PsiEnumConstantImpl.java

示例14: isDeprecated

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
public boolean isDeprecated()
{
	final PsiFieldStub stub = getStub();
	if(stub != null)
	{
		return stub.isDeprecated();
	}

	PsiDocComment docComment = getDocComment();
	return docComment != null && docComment.findTagByName("deprecated") != null || getModifierList().findAnnotation("java.lang.Deprecated") !=
			null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:14,代码来源:PsiEnumConstantImpl.java

示例15: getName

import com.intellij.psi.impl.java.stubs.PsiFieldStub; //导入依赖的package包/类
@Override
@NotNull
public String getName()
{
	final PsiFieldStub stub = getGreenStub();
	if(stub != null)
	{
		return stub.getName();
	}
	return getNameIdentifier().getText();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:12,代码来源:PsiFieldImpl.java


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