@SuppressWarnings("unchecked")
void setSender(MidiSender midiSenderSpec, ISender sender) {
midiSenderSpec.setSenderClass(sender.getClass().getName());
if (sender instanceof AbstractSender) {
AbstractSender aSender = (AbstractSender) sender;
PropertySpec property = midiSenderSpec.addNewProperty();
property.setName("offset");
property.setValue(Integer.toString(aSender.getOffset()));
} else {
try {
Map<String, String> map =
BeanUtilsBean.getInstance().describe(sender);
Iterator<Entry<String, String>> iterator =
map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> entry = iterator.next();
if (entry.getKey().equals("class")) {
continue;
}
PropertySpec propertySpec = midiSenderSpec.addNewProperty();
propertySpec.setName(entry.getKey());
propertySpec.setValue(entry.getValue());
}
} catch (IllegalAccessException e) {
LOG.warn(e.getMessage(), e);
} catch (InvocationTargetException e) {
LOG.warn(e.getMessage(), e);