public static AttributeDefinition cloneToDropdownAttributeDefinition(
AttributeDefinition oldAD,
final Collection<String> optionLabels,
final Collection<String> optionValues) {
AttributeDefinitionTransformer transformer = new DefaultDropdownTransformer() {
public boolean shouldTransform(AttributeDefinition ad) {
return true;
}
public String[] transformOptionLabels(String[] oldOptionLabels) {
return optionLabels.toArray(new String[0]);
}
public String[] transformOptionValues(String[] oldOptionValues) {
return optionValues.toArray(new String[0]);
}
};
return transformer.transform(oldAD);
}