private void parseProperties(PsiMethod method, JavaElementArrangementEntry entry) { if (!myGroupingRules.contains(StdArrangementTokens.Grouping.GETTERS_AND_SETTERS)) { return; } String propertyName = null; boolean getter = true; if (PropertyUtil.isSimplePropertyGetter(method)) { propertyName = PropertyUtil.getPropertyNameByGetter(method); } else if (PropertyUtil.isSimplePropertySetter(method)) { propertyName = PropertyUtil.getPropertyNameBySetter(method); getter = false; } if (propertyName == null) { return; } PsiClass containingClass = method.getContainingClass(); String className = null; if (containingClass != null) { className = containingClass.getQualifiedName(); } if (className == null) { className = NULL_CONTENT; } if (getter) { myInfo.registerGetter(propertyName, className, entry); } else { myInfo.registerSetter(propertyName, className, entry); } }
private static void addParameters( @NotNull PsiClass psiClass, GrLightMethodBuilder fieldsConstructor, boolean includeProperties, boolean includeFields, boolean optional, Set<String> excludes) { PsiMethod[] methods = CollectClassMembersUtil.getMethods(psiClass, false); if (includeProperties) { for (PsiMethod method : methods) { if (!method.hasModifierProperty(PsiModifier.STATIC) && PropertyUtil.isSimplePropertySetter(method)) { final String name = PropertyUtil.getPropertyNameBySetter(method); if (!excludes.contains(name)) { final PsiType type = PropertyUtil.getPropertyType(method); assert type != null : method; fieldsConstructor.addParameter( new GrLightParameter(name, type, fieldsConstructor).setOptional(optional)); } } } } final Map<String, PsiMethod> properties = PropertyUtil.getAllProperties(true, false, methods); for (PsiField field : CollectClassMembersUtil.getFields(psiClass, false)) { final String name = field.getName(); if (includeFields || includeProperties && field instanceof GrField && ((GrField) field).isProperty()) { if (!excludes.contains(name) && !field.hasModifierProperty(PsiModifier.STATIC) && !properties.containsKey(name)) { fieldsConstructor.addParameter( new GrLightParameter(name, field.getType(), fieldsConstructor).setOptional(optional)); } } } }