Spring Framework ClassEditor - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework ClassEditor class.

This code example shows how to use the following methods:
		doRegisterEditor(registry, File.class, new FileEditor(baseEditor));
		doRegisterEditor(registry, URL.class, new URLEditor(baseEditor));
		ClassLoader classLoader = this.resourceLoader.getClassLoader();
		doRegisterEditor(registry, URI.class, new URIEditor(classLoader));
		doRegisterEditor(registry, Class.class, new ClassEditor(classLoader));
		doRegisterEditor(registry, Class[].class, new ClassArrayEditor(classLoader));
		if (this.resourceLoader instanceof ResourcePatternResolver) {
			doRegisterEditor(registry, Resource[].class,
					new ResourceArrayPropertyEditor((ResourcePatternResolver) this.resourceLoader, this.propertyResolver));
	 * Override default editor, if possible (since that's what we really mean to do here); 
	 * otherwise register as a custom editor. 
	private void doRegisterEditor(PropertyEditorRegistry registry, Class<?> requiredType, PropertyEditor editor) {
		if (registry instanceof PropertyEditorRegistrySupport) {
This code example shows how to use the following methods:setAsText, getValue
String objectClassName = (String) binder.get("objectClass");
        if (objectClassName == null)
            throw new IllegalArgumentException("objectClass is required");
        Class objectClass = (Class) classEditor.getValue();
        String propertyName = (String) binder.get("propertyName");
        if (propertyName == null)
            throw new IllegalArgumentException("propertyName is required");
        if (binder.containsKey("binder"))
            Object binderParameter = binder.get("binder");
            classEditor.setAsText((String) binderParameter);
            Class binderClass = (Class) classEditor.getValue();
                registerBinderForPropertyName(objectClass, propertyName, (Binder) binderClass.newInstance());