Skip to content
Permalink
Browse files
[JXPATH-128]
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/jxpath/trunk@739019 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mbenson committed Jan 29, 2009
1 parent 71ca5c1 commit dcf3c757b10bc76a60e11dcc41a2be6971d686be
Showing 1 changed file with 10 additions and 11 deletions.
@@ -16,6 +16,7 @@
*/
package org.apache.commons.jxpath.ri.model.dynabeans;

import java.util.ArrayList;
import java.util.Arrays;

import org.apache.commons.beanutils.DynaBean;
@@ -35,6 +36,8 @@
* @version $Revision$ $Date$
*/
public class DynaBeanPropertyPointer extends PropertyPointer {
private static final String CLASS = "class";

private DynaBean dynaBean;
private String name;
private String[] names;
@@ -71,19 +74,15 @@ public String[] getPropertyNames() {
/* @todo do something about the sorting - LIKE WHAT? - MJB */
if (names == null) {
DynaClass dynaClass = dynaBean.getDynaClass();
DynaProperty[] properties = dynaClass.getDynaProperties();
int count = properties.length;
boolean hasClass = dynaClass.getDynaProperty("class") != null;
if (hasClass) {
count--; // Exclude "class" from properties
}
names = new String[count];
for (int i = 0, j = 0; i < properties.length; i++) {
String name = properties[i].getName();
if (!hasClass || !name.equals("class")) {
names[j++] = name;
DynaProperty[] dynaProperties = dynaClass.getDynaProperties();
ArrayList properties = new ArrayList(dynaProperties.length);
for (int i = 0; i < dynaProperties.length; i++) {
String name = dynaProperties[i].getName();
if (!CLASS.equals(name)) {
properties.add(name);
}
}
names = (String[]) properties.toArray(new String[properties.size()]);
Arrays.sort(names);
}
return names;

0 comments on commit dcf3c75

Please sign in to comment.