Skip to content

Instantly share code, notes, and snippets.

@amorales4u
Created August 22, 2020 02:43
Show Gist options
  • Select an option

  • Save amorales4u/d5b8fb9c3616d70f189c4437e6a0dcf1 to your computer and use it in GitHub Desktop.

Select an option

Save amorales4u/d5b8fb9c3616d70f189c4437e6a0dcf1 to your computer and use it in GitHub Desktop.
import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
public static Object toObject( Class targetType, String value ) {
PropertyEditor editor = PropertyEditorManager.findEditor(targetType);
editor.setAsText(value);
return editor.getValue();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment