java.beans

Class PropertyEditorManager


  • public class PropertyEditorManager
    extends Object
    The PropertyEditorManager can be used to locate a property editor for any given type name. This property editor must support the java.beans.PropertyEditor interface for editing a given object.

    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.

    • Constructor Detail

      • PropertyEditorManager

        public PropertyEditorManager()
    • Method Detail

      • registerEditor

        public static void registerEditor(Class<?> targetType,
                          Class<?> editorClass)
        Registers an editor class to edit values of the given target class. If the editor class is null, 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.

        If there is a security manager, its checkPropertiesAccess method is called. This could result in a SecurityException.

        Parameters:
        targetType - the class object of the type to be edited
        editorClass - the class object of the editor class
        Throws:
        SecurityException - if a security manager exists and its checkPropertiesAccess method doesn't allow setting of system properties
        See Also:
        SecurityManager.checkPropertiesAccess()
      • findEditor

        public static PropertyEditor findEditor(Class<?> targetType)
        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

        public static String[] 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

        public static void setEditorSearchPath(String[] path)
        Change the list of package names that will be used for finding property editors.

        First, if there is a security manager, its checkPropertiesAccess method is called. This could result in a SecurityException.

        Parameters:
        path - Array of package names.
        Throws:
        SecurityException - if a security manager exists and its checkPropertiesAccess method doesn't allow setting of system properties.
        See Also:
        SecurityManager.checkPropertiesAccess()

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

22/12/2024 14:24:30 Cette version de la page est en cache (à la date du 22/12/2024 14:24:30) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.

Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-java/beans/propertyeditormanager.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, PropertyEditorManager

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.

Table des matières Haut