FieldElement (PsiField field, boolean useAccessor) { FieldElement fe = new FieldElement(); fe.setName(field.getName()); final PsiMethod getterForField = useAccessor ? PropertyUtilBase.findGetterForField(field) : null; fe.setAccessor(getterForField != null ? getterForField.getName() + "()" : field.getName()); if (PsiAdapter.isConstantField(field)) fe.setConstant(true); if (PsiAdapter.isEnumField(field)) fe.setEnum(true); if (JavaPsiRecordUtil.getComponentForField(field) != null) fe.setRecordComponent(true); PsiModifierList modifiers = field.getModifierList(); if (modifiers != null) { if (modifiers.hasModifierProperty(PsiModifier.TRANSIENT)) fe.setModifierTransient(true); if (modifiers.hasModifierProperty(PsiModifier.VOLATILE)) fe.setModifierVolatile(true); } PsiElementFactory factory = JavaPsiFacade.getInstance(field.getProject()).getElementFactory(); PsiType type = field.getType(); setElementInfo(fe, factory, type, modifiers); return fe; }