(Quick Reference)

11.6 Property Editors - Reference Documentation

Authors: Andres Almiray

Version: 1.2.0

11.6 Property Editors

Resource injection makes use of the PropertyEditor mechanism provided by the java.beans package. The default ResourcesInjector queries PropertyEditorManager whenever a resource value must be transformed to a target type.

PropertyEditorManager provides methods for registering custom PropertyEditors, it also follows a class name convention to load PropertyEditors should a custom one is not programmatically registered. Griffon applications will automatically load and register PropertyEditors from the following classpath resource: /META-INF/services/java.beans.PropertyEditor. Each line follows the format


target.type = full.qualified.classname

The following table enumerates the default PropertyEditors loaded by Griffon at startup. Plugins such as swing and javafx may register additional editors.

TypeEditor Class
java.lang.Stringgriffon.core.resources.editors.StringPropertyEditor
java.io.Filegriffon.core.resources.editors.FilePropertyEditor
java.net.URLgriffon.core.resources.editors.URLPropertyEditor
java.net.URIgriffon.core.resources.editors.URIPropertyEditor

The configuration (/META-INF/services/java.beans.PropertyEditor inside griffon-rt-1.2.0.jar) for these editors is thus

java.lang.String = griffon.core.resources.editors.StringPropertyEditor
java.io.File = griffon.core.resources.editors.FilePropertyEditor
java.net.URL = griffon.core.resources.editors.URLPropertyEditor
java.net.URI = griffon.core.resources.editors.URIPropertyEditor