private List<PropertyNode> findProperties(AnnotationNode annotation, final ClassNode classNode, final List<String> includes, final List<String> excludes, final boolean allProperties, final boolean includeSuperProperties, final boolean allNames) { Set<String> names = new HashSet<String>(); List<PropertyNode> props = getAllProperties(names, classNode, classNode, true, false, allProperties, false, includeSuperProperties, false, false, allNames, false); List<PropertyNode> properties = new ArrayList<PropertyNode>(); for (PropertyNode property : props) { String propertyName = property.getName(); if ((excludes != null && excludes.contains(propertyName)) || includes != null && !includes.contains(propertyName)) continue; properties.add(property); } for (PropertyNode pNode : properties) { checkComparable(pNode); } if (includes != null) { Comparator<PropertyNode> includeComparator = new Comparator<PropertyNode>() { public int compare(PropertyNode o1, PropertyNode o2) { return Integer.compare(includes.indexOf(o1.getName()), includes.indexOf(o2.getName())); } }; Collections.sort(properties, includeComparator); } return properties; }