本文整理汇总了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;
}
};
}
示例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());
}
示例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();
}
}
示例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);
}
示例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();
}
示例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;
}
示例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();
}
}
示例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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
};
}
示例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();
}
示例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;
}
示例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();
}