StringDescriptor (final RadComponent component, final JComponent delegee) { final StringDescriptor result; if(SwingProperties.TEXT.equals(getName()) && (delegee instanceof JLabel label)){ result = StringDescriptor.create( mergeTextAndMnemonic(label.getText(), label.getDisplayedMnemonic(), label.getDisplayedMnemonicIndex()) ); } else if(SwingProperties.TEXT.equals(getName()) && (delegee instanceof AbstractButton button)){ result = StringDescriptor.create( mergeTextAndMnemonic(button.getText(), button.getMnemonic(), button.getDisplayedMnemonicIndex()) ); } else { if (component != null) { result = StringDescriptor.create((String) invokeGetter(component)); } else { try { result = StringDescriptor.create((String) myReadMethod.invoke(delegee, EMPTY_OBJECT_ARRAY)); } catch (Exception e) { throw new RuntimeException(e); } } } if (result != null) { // in this branch, the StringDescriptor is always a plain string, so resolve() is not necessary result.setResolvedValue(result.getValue()); } return result; }