}
PropertyDescriptor[] props = desc.getPropertyDescriptors();
ArrayList<PropertyDescriptor> list = new ArrayList<PropertyDescriptor>();
for (int i = 0; i < props.length; i++) {
PropertyDescriptor pd = props[i];
if (!isIgnoreProperty(pd)) {
list.add(pd);
}
}
props = new PropertyDescriptor[list.size()];
list.toArray(props);
BeansFieldEntry[] entries = new BeansFieldEntry[props.length];
for (int i = 0; i < props.length; i++) {
PropertyDescriptor p = props[i];
int index = getPropertyIndex(p);
if (index >= 0) {
if (entries[index] != null) {
throw new TemplateBuildException("duplicated index: "
+ index);
}
if (index >= entries.length) {
throw new TemplateBuildException("invalid index: " + index);
}
entries[index] = new BeansFieldEntry(p);
props[index] = null;
}
}
int insertIndex = 0;
for (int i = 0; i < props.length; i++) {
PropertyDescriptor p = props[i];
if (p != null) {
while (entries[insertIndex] != null) {
insertIndex++;
}
entries[insertIndex] = new BeansFieldEntry(p);