本文整理匯總了Java中com.intellij.psi.PsiField.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiField.getName方法的具體用法?Java PsiField.getName怎麽用?Java PsiField.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiField
的用法示例。
在下文中一共展示了PsiField.getName方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
super.visitField(field);
if (field instanceof PsiEnumConstant) {
return;
}
if (!field.hasModifierProperty(PsiModifier.STATIC) || !field.hasModifierProperty(PsiModifier.FINAL)) {
return;
}
final String name = field.getName();
if (name == null) {
return;
}
final PsiType type = field.getType();
if (onlyCheckImmutables && !ClassUtils.isImmutable(type)) {
return;
}
if (isValid(name)) {
return;
}
registerFieldError(field, name);
}
示例2: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
super.visitField(field);
if (field.hasModifierProperty(PsiModifier.STATIC) &&
field.hasModifierProperty(PsiModifier.FINAL)) {
return;
}
final String fieldName = field.getName();
if (fieldName == null) {
return;
}
if (!fieldName.equals(fieldName.toUpperCase())) {
return;
}
registerFieldError(field);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:UpperCaseFieldNameNotConstantInspectionBase.java
示例3: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
if (!field.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
if (field.hasModifierProperty(PsiModifier.FINAL)) {
if (!checkMutableFinals) {
return;
}
else {
final PsiType type = field.getType();
if (ClassUtils.isImmutable(type)) {
return;
}
}
}
final String name = field.getName();
if (name == null) {
return;
}
if (isValid(name)) {
return;
}
registerFieldError(field, name);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:26,代碼來源:StaticVariableNamingConventionInspectionBase.java
示例4: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
super.visitField(field);
if (field.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
final PsiTypeElement typeElement = field.getTypeElement();
if (typeElement == null) {
return;
}
if (!ConcreteClassUtil.typeIsConcreteClass(typeElement,
ignoreAbstractClasses)) {
return;
}
final String variableName = field.getName();
registerError(typeElement, variableName);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:InstanceVariableOfConcreteClassInspection.java
示例5: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
super.visitField(field);
if (!field.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
final PsiTypeElement typeElement = field.getTypeElement();
if (typeElement == null) {
return;
}
if (!ConcreteClassUtil.typeIsConcreteClass(typeElement,
ignoreAbstractClasses)) {
return;
}
final String variableName = field.getName();
registerError(typeElement, variableName);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:StaticVariableOfConcreteClassInspection.java
示例6: addField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
private void addField( SrcClass srcClass, PsiField field )
{
SrcField srcField = new SrcField( field.getName(), makeSrcType( field.getType() ) );
srcField.modifiers( getModifiers( field.getModifierList() ) );
if( Modifier.isFinal( (int)srcField.getModifiers() ) )
{
srcField.initializer( new SrcRawExpression( getValueForType( field.getType() ) ) );
}
srcClass.addField( srcField );
}
示例7: report
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
private static void report(String tag, WriteFieldGroupMethod method) {
String str = "";
for (PsiField field : method.provideWriteFields().values()) {
str += field.getName() +", ";
}
if (DEBUG_DETAIL) System.out.println("find issue -> " + tag + ", method=" + method.getMethod().getName() + ", fields=" + str);
}
開發者ID:cch-robo,項目名稱:Android_Lint_SRP_Practice_Example,代碼行數:8,代碼來源:SharingGroupClassificationDetector.java
示例8: getAlphaSortKey
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
@NotNull
public String getAlphaSortKey() {
final PsiField field = getElement();
if (field != null) {
String name = field.getName();
if (name != null) {
return name;
}
}
return "";
}
示例9: getElementUrl
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public String getElementUrl(final Object element) {
if (element instanceof PsiField) {
final PsiField aField = (PsiField)element;
return aField.getContainingClass().getQualifiedName() + ";" + aField.getName();
}
return null;
}
示例10: findResourcesByField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@NotNull
public List<PsiElement> findResourcesByField(@NotNull PsiField field) {
final String type = AndroidResourceUtil.getResourceClassName(field);
if (type == null) {
return Collections.emptyList();
}
final String fieldName = field.getName();
if (fieldName == null) {
return Collections.emptyList();
}
return findResourcesByFieldName(type, fieldName);
}
示例11: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
final PsiClass aClass = field.getContainingClass();
if (aClass == null) {
return;
}
final String fieldName = field.getName();
if (HardcodedMethodConstants.SERIAL_VERSION_UID.equals(fieldName)) {
return; //special case
}
PsiClass ancestorClass = aClass.getSuperClass();
final Set<PsiClass> visitedClasses = new HashSet<PsiClass>();
while (ancestorClass != null) {
if (!visitedClasses.add(ancestorClass)) {
return;
}
final PsiField ancestorField = ancestorClass.findFieldByName(fieldName, false);
ancestorClass = ancestorClass.getSuperClass();
if (ancestorField == null) {
continue;
}
if (m_ignoreInvisibleFields && !ClassUtils.isFieldVisible(ancestorField, aClass)) {
continue;
}
if (ignoreStaticFields && field.hasModifierProperty(PsiModifier.STATIC) &&
ancestorField.hasModifierProperty(PsiModifier.STATIC)) {
continue;
}
registerFieldError(field);
return;
}
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:33,代碼來源:FieldHidesSuperclassFieldInspectionBase.java
示例12: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
final PsiClass aClass = field.getContainingClass();
if (aClass == null) {
return;
}
final String fieldName = field.getName();
if (HardcodedMethodConstants.SERIAL_VERSION_UID.equals(fieldName)) {
return; //special case
}
boolean reportStaticsOnly = false;
if (aClass.hasModifierProperty(PsiModifier.STATIC)) {
reportStaticsOnly = true;
}
PsiClass ancestorClass =
ClassUtils.getContainingClass(aClass);
while (ancestorClass != null) {
final PsiField ancestorField =
ancestorClass.findFieldByName(fieldName, false);
if (ancestorField != null) {
if (!m_ignoreInvisibleFields ||
!reportStaticsOnly ||
field.hasModifierProperty(PsiModifier.STATIC)) {
registerFieldError(field);
}
}
ancestorClass = ClassUtils.getContainingClass(ancestorClass);
}
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:InnerClassVariableHidesOuterClassVariableInspectionBase.java
示例13: visitField
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Override
public void visitField(@NotNull PsiField field) {
super.visitField(field);
if (field.hasModifierProperty(PsiModifier.STATIC)) {
return;
}
final String name = field.getName();
if (name == null) {
return;
}
if (isValid(name)) {
return;
}
registerFieldError(field, name);
}
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:InstanceVariableNamingConventionInspectionBase.java
示例14: toString
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
@Nullable
@Override
public String toString(@Nullable final PsiField psiField, final ConvertContext context) {
return psiField == null ? "" : psiField.getName();
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:6,代碼來源:BeansPropertyNameConverter.java
示例15: FieldPart
import com.intellij.psi.PsiField; //導入方法依賴的package包/類
public FieldPart(boolean selected, PsiField field) {
this.selected = selected;
this.field = field;
name = field.getName();
type = field.getType().getPresentableText();
}