private static PropertyOptions convert(List<PropertyDefinitionEnumeration> options) {
if (options.isEmpty()) {
return null;
}
PropertyOptions ret = new PropertyOptions();
ArrayList<PropertyDefinitionEnumeration> opts = new ArrayList<PropertyDefinitionEnumeration>(options);
Collections.sort(opts, new Comparator<PropertyDefinitionEnumeration>() {
public int compare(PropertyDefinitionEnumeration o1, PropertyDefinitionEnumeration o2) {
return o1.getOrderIndex() - o2.getOrderIndex();
}
});
for (PropertyDefinitionEnumeration option : opts) {
ret.getOption().add(convert(option));
}
return ret;
}