Angle Tom
Angle Tom

Reputation: 1130

in java8, which class was added as a replacement of `sun.beans.editors.StringEditor`

I got the class not found error for sun.beans.editors.StringEditor, when I was trying to upgrade java6 to java8.

anyone knows which class is imported by java8 to replace this class.

Upvotes: 0

Views: 1830

Answers (1)

Holger
Holger

Reputation: 298283

The standard way of acquiring a property editor always was to use

PropertyEditor editor = PropertyEditorManager.findEditor(String.class);

which will return a JRE and/or configuration specific editor. When you do

System.out.println(editor.getClass());

you will get class com.sun.beans.editors.StringEditor with Oracle’s JDK 1.8 when no additional software has been installed. But there is no reason to ever deal with that class, the method above provides you with a working PropertEditor instance. If you need its features for your own property editor, use delegation.

Upvotes: 4

Related Questions