Java Code Examples for java.beans.PropertyEditorManager#findEditor()
The following examples show how to use
java.beans.PropertyEditorManager#findEditor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JspRuntimeLibrary.java From Tomcat8-Source-Read with MIT License | 6 votes |
public static Object getValueFromPropertyEditorManager( Class<?> attrClass, String attrName, String attrValue) throws JasperException { try { PropertyEditor propEditor = PropertyEditorManager.findEditor(attrClass); if (propEditor != null) { propEditor.setAsText(attrValue); return propEditor.getValue(); } else { throw new IllegalArgumentException( Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered")); } } catch (IllegalArgumentException ex) { throw new JasperException( Localizer.getMessage("jsp.error.beans.property.conversion", attrValue, attrClass.getName(), attrName, ex.getMessage())); } }
Example 2
Source File: Editors.java From tomee with Apache License 2.0 | 6 votes |
public static PropertyEditor get(final Class<?> type) { final PropertyEditor editor = PropertyEditorManager.findEditor(type); if (editor != null) { return editor; } final Class<Editors> c = Editors.class; try { final Class<?> editorClass = c.getClassLoader().loadClass(c.getName().replace("Editors", type.getSimpleName() + "Editor")); PropertyEditorManager.registerEditor(type, editorClass); return PropertyEditorManager.findEditor(type); } catch (final ClassNotFoundException e) { return null; } }
Example 3
Source File: Test6963811.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void run() { try { Thread.sleep(this.time); // increase the chance of the deadlock if (this.sync) { synchronized (Test6963811.class) { PropertyEditorManager.findEditor(Super.class); } } else { PropertyEditorManager.findEditor(Sub.class); } } catch (Exception exception) { exception.printStackTrace(); } }
Example 4
Source File: Test6963811.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void run() { try { Thread.sleep(this.time); // increase the chance of the deadlock if (this.sync) { synchronized (Test6963811.class) { PropertyEditorManager.findEditor(Super.class); } } else { PropertyEditorManager.findEditor(Sub.class); } } catch (Exception exception) { exception.printStackTrace(); } }
Example 5
Source File: ValuePropertyEditor.java From netbeans with Apache License 2.0 | 6 votes |
private static PropertyEditor findThePropertyEditor(Class clazz) { PropertyEditor pe; if (Object.class.equals(clazz)) { pe = null; } else { pe = PropertyEditorManager.findEditor(clazz); if (pe == null) { Class sclazz = clazz.getSuperclass(); if (sclazz != null) { pe = findPropertyEditor(sclazz); } } } classesWithPE.put(clazz, pe != null); return pe; }
Example 6
Source File: Test6963811.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void run() { try { Thread.sleep(this.time); // increase the chance of the deadlock if (this.sync) { synchronized (Test6963811.class) { PropertyEditorManager.findEditor(Super.class); } } else { PropertyEditorManager.findEditor(Sub.class); } } catch (Exception exception) { exception.printStackTrace(); } }
Example 7
Source File: TestEditor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
TestEditor(Class type) { System.out.println("Property class: " + type); this.editor = PropertyEditorManager.findEditor(type); if (this.editor == null) throw new Error("could not find editor for " + type); System.out.println("PropertyEditor class: " + this.editor.getClass()); validate(null, null); }
Example 8
Source File: Test6397609.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static boolean isEditorExist(Class type) { for (int i = 0; i < 10; i++) { System.gc(); // clean all weak references if (null == PropertyEditorManager.findEditor(type)) { return false; } } return true; }
Example 9
Source File: Test6397609.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static boolean isEditorExist(Class type) { for (int i = 0; i < 10; i++) { System.gc(); // clean all weak references if (null == PropertyEditorManager.findEditor(type)) { return false; } } return true; }
Example 10
Source File: Test4968709.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { String[] oldPath = PropertyEditorManager.getEditorSearchPath(); String[] newPath = {"aaa.bbb", "aaa.ccc",}; PropertyEditorManager.setEditorSearchPath(newPath); if (null != PropertyEditorManager.findEditor(Test4968709.class)) throw new Error("found unexpected editor"); PropertyEditorManager.setEditorSearchPath(oldPath); if (null == PropertyEditorManager.findEditor(Double.TYPE)) throw new Error("expected editor is not found"); }
Example 11
Source File: TestPropertyEditor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) { PropertyEditor actual = PropertyEditorManager.findEditor(type); if ((actual == null) && (expected != null)) { throw new Error("expected editor is not found"); } if ((actual != null) && !actual.getClass().equals(expected)) { throw new Error("found unexpected editor"); } }
Example 12
Source File: TestEditor.java From hottub with GNU General Public License v2.0 | 5 votes |
TestEditor(Class type) { System.out.println("Property class: " + type); this.editor = PropertyEditorManager.findEditor(type); if (this.editor == null) throw new Error("could not find editor for " + type); System.out.println("PropertyEditor class: " + this.editor.getClass()); validate(null, null); }
Example 13
Source File: TestPropertyEditor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) { PropertyEditor actual = PropertyEditorManager.findEditor(type); if ((actual == null) && (expected != null)) { throw new Error("expected editor is not found"); } if ((actual != null) && !actual.getClass().equals(expected)) { throw new Error("found unexpected editor"); } }
Example 14
Source File: IntrospectionSupport.java From tomee with Apache License 2.0 | 5 votes |
private static String convertToString(final Object value, final Class type) throws URISyntaxException { final PropertyEditor editor = PropertyEditorManager.findEditor(type); if (editor != null) { editor.setValue(value); return editor.getAsText(); } if (type == URI.class) { return ((URI) value).toString(); } return null; }
Example 15
Source File: Test4968709.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { String[] oldPath = PropertyEditorManager.getEditorSearchPath(); String[] newPath = {"aaa.bbb", "aaa.ccc",}; PropertyEditorManager.setEditorSearchPath(newPath); if (null != PropertyEditorManager.findEditor(Test4968709.class)) throw new Error("found unexpected editor"); PropertyEditorManager.setEditorSearchPath(oldPath); if (null == PropertyEditorManager.findEditor(Double.TYPE)) throw new Error("expected editor is not found"); }
Example 16
Source File: Test6397609.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static boolean isEditorExist(Class type) { for (int i = 0; i < 10; i++) { System.gc(); // clean all weak references if (null == PropertyEditorManager.findEditor(type)) { return false; } } return true; }
Example 17
Source File: TestPropertyEditor.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) { PropertyEditor actual = PropertyEditorManager.findEditor(type); if ((actual == null) && (expected != null)) { throw new Error("expected editor is not found"); } if ((actual != null) && !actual.getClass().equals(expected)) { throw new Error("found unexpected editor"); } }
Example 18
Source File: Test4968709.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { String[] oldPath = PropertyEditorManager.getEditorSearchPath(); String[] newPath = {"aaa.bbb", "aaa.ccc",}; PropertyEditorManager.setEditorSearchPath(newPath); if (null != PropertyEditorManager.findEditor(Test4968709.class)) throw new Error("found unexpected editor"); PropertyEditorManager.setEditorSearchPath(oldPath); if (null == PropertyEditorManager.findEditor(Double.TYPE)) throw new Error("expected editor is not found"); }
Example 19
Source File: TestPropertyEditor.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void test(Class<?> type, Class<? extends PropertyEditor> expected) { PropertyEditor actual = PropertyEditorManager.findEditor(type); if ((actual == null) && (expected != null)) { throw new Error("expected editor is not found"); } if ((actual != null) && !actual.getClass().equals(expected)) { throw new Error("found unexpected editor"); } }
Example 20
Source File: TestEditor.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
TestEditor(Class type) { System.out.println("Property class: " + type); this.editor = PropertyEditorManager.findEditor(type); if (this.editor == null) throw new Error("could not find editor for " + type); System.out.println("PropertyEditor class: " + this.editor.getClass()); validate(null, null); }