Java 类java.beans.PropertyEditorManager 实例源码

项目:incubator-netbeans    文件:ValuePropertyEditor.java   
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;
}
项目:incubator-netbeans    文件:TermOptionsPanel.java   
private void fontButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fontButtonActionPerformed
PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
if (pe != null) {
    pe.setValue(termOptions.getFont());
    DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(), FontChooser_title());

    String defaultFontString = FontChooser_defaultFont_label();
    dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
    defaultFontString, DialogDescriptor.CANCEL_OPTION});  //NOI18N
    DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
    if (dd.getValue() == DialogDescriptor.OK_OPTION) {
    Font f = (Font) pe.getValue();
    termOptions.setFont(f);
    applyTermOptions();
    } else if (dd.getValue() == defaultFontString) {
    Font controlFont = UIManager.getFont("controlFont");            //NOI18N
    int fontSize = (controlFont == null) ? 12 : controlFont.getSize();
    termOptions.setFont(new Font("monospaced", Font.PLAIN, fontSize));  //NOI18N
    }
}
   }
项目:incubator-netbeans    文件:PELookupTest.java   
public void testPackageUnregistering() {
    MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test1.pkg"));
    NodeOp.registerPropertyEditors();
    MockLookup.setInstances(new NodesRegistrationSupport.PEPackageRegistration("test2.pkg"));

    String[] editorSearchPath = PropertyEditorManager.getEditorSearchPath();
    int count = 0;
    for (int i = 0; i < editorSearchPath.length; i++) {
        assertNotSame("test1.pkg", editorSearchPath[i]);
        if ("test2.pkg".equals(editorSearchPath[i])) {
            count++;
        }
    }
    assertEquals(1, count);

}
项目:incubator-netbeans    文件:OutputSettingsPanel.java   
private void btnSelectFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectFontActionPerformed
    PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
    if (pe != null) {
        pe.setValue(outputOptions.getFont());
        DialogDescriptor dd = new DialogDescriptor(pe.getCustomEditor(),
                NbBundle.getMessage(Controller.class,
                "LBL_Font_Chooser_Title"));                         //NOI18N
        String defaultFont = NbBundle.getMessage(Controller.class,
                "BTN_Defaul_Font");                                 //NOI18N
        dd.setOptions(new Object[]{DialogDescriptor.OK_OPTION,
                    defaultFont, DialogDescriptor.CANCEL_OPTION});  //NOI18N
        DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
        if (dd.getValue() == DialogDescriptor.OK_OPTION) {
            Font f = (Font) pe.getValue();
            outputOptions.setFont(f);
        } else if (dd.getValue() == defaultFont) {
            outputOptions.setFont(null);
        }
        updateFontField();
    }
}
项目:Pogamut3    文件:Introspector.java   
public static Property getProperty(Field field, Object object) {
    // access also protected and private fields
    field.setAccessible(true);

    // Properties are only primitive types marked by Prop annotation
    if (field.isAnnotationPresent(JProp.class)) {
        // We require that class of the field to be loaded, because we often specify
        // the PropertyEditor there in static block.
        forceInitialization(field.getType());

        //TODO this condition should be used on client when deciding whether to show an editor for it
        if (PropertyEditorManager.findEditor(field.getType()) != null) {
            // add the property
            return new JavaProperty(object, field);
        }
    }
    return null;
}
项目:neoscada    文件:PropertyEditorRegistry.java   
/**
 * @param requiredType
 * @param propertyPath
 * @return
 */
public PropertyEditor findCustomEditor ( final Class<?> requiredType, final String propertyPath )
{
    // first try to find exact match
    String key = requiredType.getCanonicalName () + ":" + propertyPath;
    PropertyEditor pe = this.propertyEditors.get ( key );
    // 2nd: try to find for class only
    if ( pe == null )
    {
        key = requiredType.getCanonicalName () + ":";
        pe = this.propertyEditors.get ( key );
    }
    // 3rd: try to get internal
    if ( pe == null )
    {
        pe = PropertyEditorManager.findEditor ( requiredType );
    }
    return pe;
}
项目:tomcat7    文件:JspRuntimeLibrary.java   
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()));
    }
}
项目:lams    文件:JspRuntimeLibrary.java   
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()));
}
   }
项目:apache-tomcat-7.0.73-with-comment    文件:JspRuntimeLibrary.java   
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()));
    }
}
项目:MaxSim    文件:FontChooserDialog.java   
public static Font show(Font initialFont) {
    PropertyEditor pe = PropertyEditorManager.findEditor(Font.class);
    if (pe == null) {
        throw new RuntimeException("Could not find font editor component.");
    }
    pe.setValue(initialFont);
    DialogDescriptor dd = new DialogDescriptor(
            pe.getCustomEditor(),
            "Choose Font");
    DialogDisplayer.getDefault().createDialog(dd).setVisible(true);
    if (dd.getValue() == DialogDescriptor.OK_OPTION) {
        Font f = (Font)pe.getValue();
        return f;
    }
    return initialFont;
}
项目:jdk8u-jdk    文件:Test6963811.java   
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();
    }
}
项目:openjdk-jdk10    文件:Test6963811.java   
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();
    }
}
项目:lazycat    文件:JspRuntimeLibrary.java   
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()));
    }
}
项目:openjdk9    文件:Test6963811.java   
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();
    }
}
项目:beyondj    文件:JspRuntimeLibrary.java   
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()));
    }
}
项目:eva2    文件:PropertyEditorProvider.java   
/**
 * Retrieve an editor object for a given class.
 * This method seems unable to retrieve a primitive editor for obscure reasons.
 * So better use the one based on PropertyDescriptor if possible.
 */
public static PropertyEditor findEditor(Class<?> cls) {
    PropertyEditor editor = PropertyEditorManager.findEditor(cls);

    // Try to unwrap primitives
    if (editor == null && Primitives.isWrapperType(cls)) {
        editor = PropertyEditorManager.findEditor(Primitives.unwrap(cls));
    }

    if ((editor == null) && useDefaultGOE) {
        if (cls.isArray()) {
            Class<?> unwrapped = Primitives.isWrapperType(cls.getComponentType()) ? Primitives.unwrap(cls.getComponentType()) : cls;
            if (unwrapped.isPrimitive()) {
                editor = new ArrayEditor();
            } else {
                editor = new ObjectArrayEditor<>(unwrapped.getComponentType());
            }
        } else if (cls.isEnum()) {
            editor = new EnumEditor();
        } else {
            editor = new GenericObjectEditor();
            ((GenericObjectEditor)editor).setClassType(cls);
        }
    }
    return editor;
}
项目:netbeansplugins    文件:LocalenbPanel.java   
/**
 * Load values from the LocaleOption
 */
void load() {
    final LocaleOption localeOption = LocaleOption.getDefault();

    final String[] datePatternsList = localeOption.getDatePatternList();
    this.datePatternsPE = PropertyEditorManager.findEditor(String[].class);
    this.datePatternsPE.setValue( datePatternsList );

    final String[] messagePatternsList = localeOption.getMessagePatternList();
    this.messagePatternsPE = PropertyEditorManager.findEditor(String[].class);
    this.messagePatternsPE.setValue( messagePatternsList );

    final String[] numberPatternsList = localeOption.getNumberPatternList();
    this.numberPatternsPE = PropertyEditorManager.findEditor(String[].class);
    this.numberPatternsPE.setValue( numberPatternsList );

    //---
    this.datePatternsTextField.setText( this.datePatternsPE.getAsText() );
    this.messagePatternsTextField.setText( this.messagePatternsPE.getAsText() );
    this.numberPatternsTextField.setText( this.numberPatternsPE.getAsText() );


    this.dateParseFormattedTextField.setValue( localeOption.getMessageArgDatePattern() );
    this.numberParseFormattedTextField.setValue( localeOption.getMessageArgNumberPattern() );
}
项目:jdk8u_jdk    文件:Test6963811.java   
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();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:Test6963811.java   
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();
    }
}
项目:aries-rsa    文件:IntrospectionSupport.java   
private static Object convert(Object value, Class<?> type) {
    if( type.isArray() ) {
        if( value.getClass().isArray() ) {
            int length = Array.getLength(value);
            Class<?> componentType = type.getComponentType();
            Object rc = Array.newInstance(componentType, length);
            for (int i = 0; i < length; i++) {
                Object o = Array.get(value, i);
                Array.set(rc, i, convert(o, componentType));
            }
            return rc;
        }
    }
    PropertyEditor editor = PropertyEditorManager.findEditor(type);
    if (editor != null) {
        editor.setAsText(value.toString());
        return editor.getValue();
    }
    return null;
}
项目:repo.kmeanspp.silhouette_score    文件:GenericObjectEditor.java   
public static void registerEditor(String name, String value) {
  Class<?> baseCls;
  Class<?> cls;

  try {
    // array class?
    if (name.endsWith("[]")) {
      baseCls = Class.forName(name.substring(0, name.indexOf("[]")));
      cls = Array.newInstance(baseCls, 1).getClass();
    } else {
      cls = Class.forName(name);
    }
    // register
    PropertyEditorManager.registerEditor(cls, Class.forName(value));
  } catch (Exception e) {
    Logger.log(weka.core.logging.Logger.Level.WARNING, "Problem registering "
      + name + "/" + value + ": " + e);
  }
}
项目:Camel    文件:IntrospectionSupport.java   
private static Object convert(TypeConverter typeConverter, Class<?> type, Object value)
    throws URISyntaxException, NoTypeConversionAvailableException {
    if (typeConverter != null) {
        return typeConverter.mandatoryConvertTo(type, value);
    }
    if (type == URI.class) {
        return new URI(value.toString());
    }
    PropertyEditor editor = PropertyEditorManager.findEditor(type);
    if (editor != null) {
        // property editor is not thread safe, so we need to lock
        Object answer;
        synchronized (LOCK) {
            editor.setAsText(value.toString());
            answer = editor.getValue();
        }
        return answer;
    }
    return null;
}
项目:kc-rice    文件:ObjectPropertyUtils.java   
/**
 * Get a property editor given a property type.
 *
 * @param propertyType The property type to look up an editor for.
 * @param path The property path, if applicable.
 * @return property editor
 */
public static PropertyEditor getPropertyEditor(Class<?> propertyType) {
    PropertyEditorRegistry registry = getPropertyEditorRegistry();
    PropertyEditor editor = null;

    if (registry != null) {
        editor = registry.findCustomEditor(propertyType, null);
    } else {

        DataDictionaryService dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
        Map<Class<?>, String> editorMap = dataDictionaryService.getPropertyEditorMap();
        String editorPrototypeName = editorMap == null ? null : editorMap.get(propertyType);

        if (editorPrototypeName != null) {
            editor = (PropertyEditor) dataDictionaryService.getDataDictionary().getDictionaryPrototype(editorPrototypeName);
        }
    }

    if (editor == null && propertyType != null) {
        // Fall back to default beans lookup
        editor = PropertyEditorManager.findEditor(propertyType);
    }

    return editor;
}
项目:packagedrone    文件:JspRuntimeLibrary.java   
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()));
}
   }
项目:netbeans-mmd-plugin    文件:MMDCfgPanel.java   
private void buttonFontActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonFontActionPerformed
  final PropertyEditor editor = PropertyEditorManager.findEditor(Font.class);
  if (editor == null) {
    LOGGER.error("Can't find any font editor");
    NbUtils.msgError(null, "Can't find editor! Unexpected state! Contact developer!");
    return;
  }
  editor.setValue(this.config.getFont());

  final DialogDescriptor descriptor = new DialogDescriptor(
      editor.getCustomEditor(),
      "Mind map font"
  );

  DialogDisplayer.getDefault().createDialog(descriptor).setVisible(true);
  if (descriptor.getValue() == DialogDescriptor.OK_OPTION) {
    this.config.setFont((Font) editor.getValue());
    updateFontButton(this.config);
    if (changeNotificationAllowed) {
      this.controller.changed();
    }
  }
}
项目:eva2    文件:PropertyEditorProvider.java   
/**
 * Retrieve an editor object for a given class.
 * This method seems unable to retrieve a primitive editor for obscure reasons.
 * So better use the one based on PropertyDescriptor if possible.
 */
public static PropertyEditor findEditor(Class<?> cls) {
    PropertyEditor editor = PropertyEditorManager.findEditor(cls);

    // Try to unwrap primitives
    if (editor == null && Primitives.isWrapperType(cls)) {
        editor = PropertyEditorManager.findEditor(Primitives.unwrap(cls));
    }

    if ((editor == null) && useDefaultGOE) {
        if (cls.isArray()) {
            Class<?> unwrapped = Primitives.isWrapperType(cls.getComponentType()) ? Primitives.unwrap(cls.getComponentType()) : cls;
            if (unwrapped.isPrimitive()) {
                editor = new ArrayEditor();
            } else {
                editor = new ObjectArrayEditor<>(unwrapped.getComponentType());
            }
        } else if (cls.isEnum()) {
            editor = new EnumEditor();
        } else {
            editor = new GenericObjectEditor();
            ((GenericObjectEditor)editor).setClassType(cls);
        }
    }
    return editor;
}
项目:autoweka    文件:GenericObjectEditor.java   
public static void registerEditor(String name, String value) {
  Class              baseCls;
  Class               cls;

  try {
    // array class?
    if (name.endsWith("[]")) {
      baseCls = Class.forName(name.substring(0, name.indexOf("[]")));
      cls = Array.newInstance(baseCls, 1).getClass();
    }
    else {
      cls = Class.forName(name);
    }
    // register
    PropertyEditorManager.registerEditor(cls, Class.forName(value));
  }
  catch (Exception e) {
    System.err.println("Problem registering " + name + "/" + value + ": " + e);
  }
}
项目:umple    文件:GenericObjectEditor.java   
public static void registerEditor(String name, String value) {
  Class<?> baseCls;
  Class<?> cls;

  try {
    // array class?
    if (name.endsWith("[]")) {
      baseCls = Class.forName(name.substring(0, name.indexOf("[]")));
      cls = Array.newInstance(baseCls, 1).getClass();
    } else {
      cls = Class.forName(name);
    }
    // register
    PropertyEditorManager.registerEditor(cls, Class.forName(value));
  } catch (Exception e) {
    Logger.log(weka.core.logging.Logger.Level.WARNING, "Problem registering "
      + name + "/" + value + ": " + e);
  }
}
项目:daq-eclipse    文件:IntrospectionSupport.java   
private static boolean isSettableType(Class clazz) {
    if (PropertyEditorManager.findEditor(clazz) != null) {
        return true;
    }
    if (clazz == URI.class) {
        return true;
    }
    if (clazz == File.class) {
        return true;
    }
    if (clazz == File[].class) {
        return true;
    }
    if (clazz == Boolean.class) {
        return true;
    }
    return false;
}
项目:infobip-open-jdk-8    文件:Test6963811.java   
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();
    }
}
项目:jdk8u-dev-jdk    文件:Test6963811.java   
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();
    }
}
项目:mocha-mvc    文件:StringPEConverter.java   
@Override
public Object convertOne(Class<?> type, InvokeContext ctx, Object from) {
    if (from != null && !(from instanceof String)) {
        return NOT_CONVERTABLE;
    }
    PropertyEditor pe = PropertyEditorManager.findEditor(type);
    if (pe == null) {
        return NOT_CONVERTABLE;
    }
    if (from == null) {
        return null;
    } else {
        try {
            pe.setAsText((String) from);
            return pe.getValue();
        } catch (Exception e) {
            log.warn("Can't convert parameter to {}", type.getName(), e);
            return NOT_CONVERTABLE;
        }
    }
}
项目:jdk7-jdk    文件:Test6963811.java   
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();
    }
}
项目:openjdk-source-code-learn    文件:Test6963811.java   
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();
    }
}
项目:class-guard    文件:JspRuntimeLibrary.java   
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()));
    }
}
项目:OLD-OpenJDK8    文件:Test6963811.java   
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();
    }
}
项目:rice    文件:ObjectPropertyUtils.java   
/**
 * Get a property editor given a property type.
 *
 * @param propertyType The property type to look up an editor for.
 * @param path The property path, if applicable.
 * @return property editor
 */
public static PropertyEditor getPropertyEditor(Class<?> propertyType) {
    PropertyEditorRegistry registry = getPropertyEditorRegistry();
    PropertyEditor editor = null;

    if (registry != null) {
        editor = registry.findCustomEditor(propertyType, null);
    } else {

        DataDictionaryService dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService();
        Map<Class<?>, String> editorMap = dataDictionaryService.getPropertyEditorMap();
        String editorPrototypeName = editorMap == null ? null : editorMap.get(propertyType);

        if (editorPrototypeName != null) {
            editor = (PropertyEditor) dataDictionaryService.getDataDictionary().getDictionaryPrototype(editorPrototypeName);
        }
    }

    if (editor == null && propertyType != null) {
        // Fall back to default beans lookup
        editor = PropertyEditorManager.findEditor(propertyType);
    }

    return editor;
}
项目:cn1    文件:PropertyEditorManagerTest.java   
public void testStringEditor_SetAsText_Null() {
    PropertyEditor editor = PropertyEditorManager.findEditor(String.class);

    editor.setAsText("null");
    assertEquals("null", editor.getAsText());
    assertEquals("\"null\"", editor.getJavaInitializationString());
    assertEquals("null", editor.getValue());

    editor.setAsText("");
    assertEquals("", editor.getAsText());
    assertEquals("\"\"", editor.getJavaInitializationString());

    editor.setAsText(null);
    assertEquals("null", editor.getAsText());
    assertEquals("\"null\"", editor.getJavaInitializationString());
    assertNull(editor.getValue());
}
项目:cn1    文件:PropertyEditorManagerRegressionTest.java   
public void testFindEditorAccordingPath_2() throws Exception {
    // Regression Harmony-1205
    String newPath[] = new String[origPath.length + 1];
    newPath[origPath.length] = "org.apache.harmony.beans.tests.support";
    for (int i = 0; i < origPath.length; i++) {
        newPath[i] = origPath[i];
    }

    PropertyEditorManager.setEditorSearchPath(newPath);

    PropertyEditor editor = PropertyEditorManager.findEditor(Class
            .forName("java.lang.String"));

    assertEquals(org.apache.harmony.beans.editors.StringEditor.class,
            editor.getClass());
}
项目:apache-tomcat-7.0.57    文件:JspRuntimeLibrary.java   
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()));
    }
}