Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1752dae0
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
1752dae0
编写于
1月 21, 2010
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
4968536: DOC: Javadoc for java.beans.Encoder.getPersistenceDelegate is incomplete
Reviewed-by: peterz
上级
9f1775d5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
67 addition
and
42 deletion
+67
-42
src/share/classes/java/beans/Encoder.java
src/share/classes/java/beans/Encoder.java
+67
-42
未找到文件。
src/share/classes/java/beans/Encoder.java
浏览文件 @
1752dae0
/*
* Copyright 2000-20
09
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 2000-20
10
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -112,54 +112,82 @@ public class Encoder {
/**
* Returns the persistence delegate for the given type.
* The persistence delegate is calculated
*
by applying the following of
rules in order:
* <
u
l>
* The persistence delegate is calculated
by applying
*
the following
rules in order:
* <
o
l>
* <li>
* If the type is an array, an internal persistence
* delegate is returned which will instantiate an
* array of the appropriate type and length, initializing
* each of its elements as if they are properties.
* If a persistence delegate is associated with the given type
* by using the {@link #setPersistenceDelegate} method
* it is returned.
* <li>
* If the type is a proxy, an internal persistence
* delegate is returned which will instantiate a
* new proxy instance using the static
* "newProxyInstance" method defined in the
* Proxy class.
* A persistence delegate is then looked up by the name
* composed of the the fully qualified name of the given type
* and the "PersistenceDelegate" postfix.
* For example, a persistence delegate for the {@code Bean} class
* should be named {@code BeanPersistenceDelegate}
* and located in the same package.
* <pre>
* public class Bean { ... }
* public class BeanPersistenceDelegate { ... }</pre>
* The instance of the {@code BeanPersistenceDelegate} class
* is returned for the {@code Bean} class.
* <li>
* If the
BeanInfo for this type has a <code>BeanDescriptor</code>
*
which defined a "persistenceDelegate" property, this
*
value is returned
.
* If the
type is {@code null},
*
a shared internal persistence delegate is returned
*
that encodes {@code null} value
.
* <li>
* In all other cases the default persistence delegate
* is returned. The default persistence delegate assumes
* the type is a <em>JavaBean</em>, implying that it has a default constructor
* and that its state may be characterized by the matching pairs
* of "setter" and "getter" methods returned by the Introspector.
* If the type is a {@code enum} declaration,
* a shared internal persistence delegate is returned
* that encodes constants of this enumeration
* by their names.
* <li>
* If the type is a primitive type or the corresponding wrapper,
* a shared internal persistence delegate is returned
* that encodes values of the given type.
* <li>
* If the type is an array,
* a shared internal persistence delegate is returned
* that encodes an array of the appropriate type and length,
* and each of its elements as if they are properties.
* <li>
* If the type is a proxy,
* a shared internal persistence delegate is returned
* that encodes a proxy instance by using
* the {@link java.lang.reflect.Proxy#newProxyInstance} method.
* <li>
* If the {@link BeanInfo} for this type has a {@link BeanDescriptor}
* which defined a "persistenceDelegate" attribute,
* the value of this named attribute is returned.
* <li>
* In all other cases the default persistence delegate is returned.
* The default persistence delegate assumes the type is a <em>JavaBean</em>,
* implying that it has a default constructor and that its state
* may be characterized by the matching pairs of "setter" and "getter"
* methods returned by the {@link Introspector} class.
* The default constructor is the constructor with the greatest number
* of parameters that has the {@link ConstructorProperties} annotation.
* If none of the constructors ha
ve
the {@code ConstructorProperties} annotation,
* If none of the constructors ha
s
the {@code ConstructorProperties} annotation,
* then the nullary constructor (constructor with no parameters) will be used.
* For example, in the following the nullary constructor
* for {@code Foo} will be used, while the two parameter constructor
* for {@code Bar} will be used.
* <code>
* public class Foo {
* For example, in the following code fragment, the nullary constructor
* for the {@code Foo} class will be used,
* while the two-parameter constructor
* for the {@code Bar} class will be used.
* <pre>
* public class Foo {
* public Foo() { ... }
* public Foo(int x) { ... }
*
}
*
public class Bar {
* }
* public class Bar {
* public Bar() { ... }
* @ConstructorProperties({"x"})
* public Bar(int x) { ... }
* @ConstructorProperties({"x", "y"})
* public Bar(int x, int y) { ... }
* }
* </code>
* </ul>
* }</pre>
* </ol>
*
* @param
type The type of the object.
* @return
The persistence delegate for this type of object.
* @param
type the class of the objects
* @return
the persistence delegate for the given type
*
* @see #setPersistenceDelegate
* @see java.beans.Introspector#getBeanInfo
...
...
@@ -176,21 +204,18 @@ public class Encoder {
}
/**
* Sets the persistence delegate associated with this <code>type</code> to
* <code>persistenceDelegate</code>.
* Associates the specified persistence delegate with the given type.
*
* @param
type The class of objects that <code>persistenceDelegate</code> applies to.
* @param
persistenceDelegate The persistence delegate for instances of <code>type</code>.
* @param
type the class of objects that the specified persistence delegate applies to
* @param
delegate the persistence delegate for instances of the given type
*
* @see #getPersistenceDelegate
* @see java.beans.Introspector#getBeanInfo
* @see java.beans.BeanInfo#getBeanDescriptor
*/
public
void
setPersistenceDelegate
(
Class
<?>
type
,
PersistenceDelegate
persistenceDelegate
)
{
public
void
setPersistenceDelegate
(
Class
<?>
type
,
PersistenceDelegate
delegate
)
{
synchronized
(
this
.
finder
)
{
this
.
finder
.
register
(
type
,
persistenceD
elegate
);
this
.
finder
.
register
(
type
,
d
elegate
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录