Class PropertyEditorManager
The PropertyEditorManager uses three techniques for locating an editor for a given type. First, it provides a registerEditor method to allow an editor to be specifically registered for a given type. Second it tries to locate a suitable class by adding "Editor" to the full qualified classname of the given type (e.g. "foo.bah.FozEditor"). Finally it takes the simple classname (without the package name) adds "Editor" to it and looks in a search-path of packages for a matching class.
So for an input class foo.bah.Fred, the PropertyEditorManager would first look in its tables to see if an editor had been registered for foo.bah.Fred and if so use that. Then it will look for a foo.bah.FredEditor class. Then it will look for (say) standardEditorsPackage.FredEditor class.
Default PropertyEditors will be provided for the Java primitive types "boolean", "byte", "short", "int", "long", "float", and "double"; and for the classes java.lang.String. java.awt.Color, and java.awt.Font.
- Since:
- 1.1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertyEditorfindEditor(Class<?> targetType) Locate a value editor for a given target type.static String[]Gets the package names that will be searched for property editors.static voidregisterEditor(Class<?> targetType, Class<?> editorClass) Registers an editor class to edit values of the given target class.static voidsetEditorSearchPath(String[] path) Change the list of package names that will be used for finding property editors.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
PropertyEditorManager
public PropertyEditorManager()Constructs aPropertyEditorManager.
-
-
Method Details
-
registerEditor
Registers an editor class to edit values of the given target class. If the editor class isnull, then any existing definition will be removed. Thus this method can be used to cancel the registration. The registration is canceled automatically if either the target or editor class is unloaded.- Parameters:
targetType- the class object of the type to be editededitorClass- the class object of the editor class
-
findEditor
Locate a value editor for a given target type.- Parameters:
targetType- The Class object for the type to be edited- Returns:
- An editor object for the given target class. The result is null if no suitable editor can be found.
-
getEditorSearchPath
Gets the package names that will be searched for property editors.- Returns:
- The array of package names that will be searched in
order to find property editors.
The default value for this array is implementation-dependent, e.g. Sun implementation initially sets to {"sun.beans.editors"}.
-
setEditorSearchPath
Change the list of package names that will be used for finding property editors.- Parameters:
path- Array of package names.
-