©
本文档使用
php.cn手册 发布
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Objectjava.beans.PropertyEditorManager
public class PropertyEditorManager
PropertyEditorManager 可用于查找任何给定类型名称的属性编辑器。此属性编辑器必须支持 java.beans.PropertyEditor 接口,以编辑给定的对象。
PropertyEditorManager 使用三种技术来查找给定类型的编辑器。首先,它提供一个 registerEditor 方法,允许专门为某一给定类型注册编辑器。其次,它试图通过将 "Editor" 添加到给定类型的完全限定类名中(例如 "foo.bah.FozEditor")来查找合适的类。最后,它使用简单的类名称(没有包名称)添加 "Editor",并在包的搜索路径中查找匹配类。
因此,对于输入类 foo.bah.Fred,PropertyEditorManager 首先将查看其表以确定是否已经为 foo.bah.Fred 注册了编辑器,若已注册,则使用它。然后它将查找 foo.bah.FredEditor 类。接着将查找(比如说)standardEditorsPackage.FredEditor 类。
默认 PropertyEditor 将被提供给 Java 基本类型 "boolean"、"byte"、"short"、"int"、"long"、"float" 和 "double";并提供给类 java.lang.String、java.awt.Color 和 java.awt.Font。
构造方法摘要 | |
---|---|
PropertyEditorManager()
|
方法摘要 | |
---|---|
static PropertyEditor |
findEditor(Class<?> targetType)
查找给定目标类型的值编辑器。 |
static String[] |
getEditorSearchPath()
获得用来搜索属性编辑器的包名称。 |
static void |
registerEditor(Class<?> targetType,
Class<?> editorClass)
注册一个将用来编辑给定目标类的值的编辑器类。 |
static void |
setEditorSearchPath(String[] path)
更改将用来查找属性编辑器的包名称的列表。 |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public PropertyEditorManager()
方法详细信息 |
---|
public static void registerEditor(Class<?> targetType, Class<?> editorClass)
如果有安全管理器,则首先调用其 checkPropertiesAccess
方法。这可能会导致 SecurityException 异常。
targetType
- 要被编辑类型的 Class 对象editorClass
- 编辑器类的 Class 对象。如果该参数为 null,则将移除所有现有定义。
SecurityException
- 如果安全管理器存在并且其 checkPropertiesAccess
方法不允许设置系统属性。SecurityManager.checkPropertiesAccess()
public static PropertyEditor findEditor(Class<?> targetType)
targetType
- 要被编辑类型的 Class 对象
public static String[] getEditorSearchPath()
此数组的默认值与实现有关,例如,Sun 实现最初被设置为 {"sun.beans.editors"}。
public static void setEditorSearchPath(String[] path)
如果有安全管理器,则首先调用其 checkPropertiesAccess
方法。这可能会导致 SecurityException 异常。
path
- 包名称数组。
SecurityException
- 如果安全管理器存在并且其 checkPropertiesAccess
方法不允许设置系统属性。SecurityManager.checkPropertiesAccess()
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。