PropertyGroup (PsiElement object, final TreeElement treeElement) { if (object instanceof PsiField field) { PropertyGroup group = new PropertyGroup(PropertyUtilBase.suggestPropertyName(field), field.getType(), field.hasModifierProperty(PsiModifier.STATIC), field.getProject()); group.setField(field); group.myChildren.add(treeElement); return group; } else if (object instanceof PsiMethod method) { final PropertyAccessorDetector.PropertyAccessorInfo accessorInfo = PropertyAccessorDetector.detectFrom(method); if (null != accessorInfo && (accessorInfo.isKindOf(PropertyKind.GETTER) || accessorInfo.isKindOf(PropertyKind.SETTER))) { PropertyGroup group = new PropertyGroup(accessorInfo.propertyName(), accessorInfo.propertyType(), method.hasModifierProperty(PsiModifier.STATIC), method.getProject()); if (accessorInfo.isKindOf(PropertyKind.GETTER)) { group.setGetter(method); } else { group.setSetter(method); } group.myChildren.add(treeElement); return group; } } return null; }