Skip to content

Commit 6bfd018

Browse files
committed
8366002: Beans.instantiate needs to describe the lookup procedure
Reviewed-by: serb, aivanov
1 parent 7f070d3 commit 6bfd018

File tree

1 file changed

+32
-0
lines changed
  • src/java.desktop/share/classes/java/beans

1 file changed

+32
-0
lines changed

src/java.desktop/share/classes/java/beans/Beans.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,22 @@ public Beans() {}
6464
* <p>
6565
* Instantiate a JavaBean.
6666
* </p>
67+
* The bean is created based on a name relative to a class-loader.
68+
* This name should be a {@linkplain ClassLoader##binary-name binary name} of a class such as "a.b.C".
69+
* <p>
70+
* The given name can indicate either a serialized object or a class.
71+
* We first try to treat the {@code beanName} as a serialized object
72+
* name then as a class name.
73+
* <p>
74+
* When using the {@code beanName} as a serialized object name we convert the
75+
* given {@code beanName} to a resource pathname and add a trailing ".ser" suffix.
76+
* We then try to load a serialized object from that resource.
77+
* <p>
78+
* For example, given a {@code beanName} of "x.y", {@code Beans.instantiate} would first
79+
* try to read a serialized object from the resource "x/y.ser" and if
80+
* that failed it would try to load the class "x.y" and create an
81+
* instance of that class.
82+
*
6783
* @return a JavaBean
6884
* @param cls the class-loader from which we should create
6985
* the bean. If this is null, then the system
@@ -84,6 +100,22 @@ public static Object instantiate(ClassLoader cls, String beanName) throws IOExce
84100
* <p>
85101
* Instantiate a JavaBean.
86102
* </p>
103+
* The bean is created based on a name relative to a class-loader.
104+
* This name should be a {@linkplain ClassLoader##binary-name binary name} of a class such as "a.b.C".
105+
* <p>
106+
* The given name can indicate either a serialized object or a class.
107+
* We first try to treat the {@code beanName} as a serialized object
108+
* name then as a class name.
109+
* <p>
110+
* When using the {@code beanName} as a serialized object name we convert the
111+
* given {@code beanName} to a resource pathname and add a trailing ".ser" suffix.
112+
* We then try to load a serialized object from that resource.
113+
* <p>
114+
* For example, given a {@code beanName} of "x.y", {@code Beans.instantiate} would first
115+
* try to read a serialized object from the resource "x/y.ser" and if
116+
* that failed it would try to load the class "x.y" and create an
117+
* instance of that class.
118+
*
87119
* @return a JavaBean
88120
*
89121
* @param cls the class-loader from which we should create

0 commit comments

Comments
 (0)