public class PropertyEditorManager extends Object
的propertyeditormanager采用三技术来定位一个给定的类型编辑。首先,它提供了一个允许编辑器是专门注册了RegisterEditor方法对于一个给定的类型。第二,它试图找到一个合适的类中添加“编辑”的给定类型的完全限定类名(如“foo。呸。fozeditor”)。最后以简单的类名(不包名称)增加了“编辑”,看起来在一个一个匹配的类包的搜索路径。
所以对于一个输入级的foo.bah.fred,propertyeditormanager首先会看它的表看编辑已注册为foo.bah.fred如果使用。然后,它会寻找一个foo.bah.frededitor类。然后它会寻找(说)standardeditorspackage.frededitor类。
默认propertyeditors将提供的java的原始数据类型“布尔”,“字节”、“短”、“国际”、“长”、“浮”、和“双”;和班java.lang.string。java.awt.color,和java.awt.font。
Constructor and Description |
---|
PropertyEditorManager() |
Modifier and Type | Method and Description |
---|---|
static PropertyEditor |
findEditor(类<?> targetType)
为一个给定的目标类型找到一个值编辑器。
|
static String[] |
getEditorSearchPath()
获取将要搜索的属性编辑器的包名称。
|
static void |
registerEditor(类<?> targetType, 类<?> editorClass)
注册一个编辑器类来编辑给定目标类的值。
|
static void |
setEditorSearchPath(String[] path)
更改将被用于寻找属性编辑器的包名称列表。
|
public static void registerEditor(类<?> targetType, 类<?> editorClass)
null
,那么任何现有的定义将被删除。因此,这种方法可以用来取消注册。如果目标或编辑器类被卸载,则自动取消注册。
如果存在安全管理器,它的checkPropertiesAccess
方法称为。这可能会导致一个SecurityException。
targetType
型要编辑的对象
editorClass
-编辑类的类对象
SecurityException
-如果存在一个安全管理及其
checkPropertiesAccess
方法不允许系统属性的设置
SecurityManager.checkPropertiesAccess()
public static PropertyEditor findEditor(类<?> targetType)
targetType
-类型要编辑的对象
public static String[] getEditorSearchPath()
此数组的默认值是依赖于实现的,例如,最初设置为“太阳”的“太阳执行”。
public static void setEditorSearchPath(String[] path)
首先,如果存在安全管理器,它的checkPropertiesAccess
方法称为。这可能导致SecurityException。
path
-包名的数组。
SecurityException
-如果存在一个安全管理及其
checkPropertiesAccess
方法不允许系统属性的设置。
SecurityManager.checkPropertiesAccess()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.