📄 beans.html
字号:
<DD><p> Instantiate a JavaBean. </p><DD><DL><DT><B>Parameters:</B><DD><CODE>classLoader</CODE> - the class-loader from which we should create the bean. If this is null, then the system class-loader is used.<DD><CODE>beanName</CODE> - the name of the bean within the class-loader. For example "sun.beanbox.foobah"<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></CODE> - if the class of a serialized object could not be found.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.</DL></DD></DL><HR><A NAME="instantiate(java.lang.ClassLoader, java.lang.String, java.beans.beancontext.BeanContext)"><!-- --></A><H3>instantiate</H3><PRE>public static <A HREF="../../java/lang/Object.html">Object</A> <B>instantiate</B>(<A HREF="../../java/lang/ClassLoader.html">ClassLoader</A> cls, <A HREF="../../java/lang/String.html">String</A> beanName, <A HREF="../../java/beans/beancontext/BeanContext.html">BeanContext</A> beanContext) throws <A HREF="../../java/io/IOException.html">IOException</A>, <A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></PRE><DL><DD><p> Instantiate a JavaBean. </p><DD><DL><DT><B>Parameters:</B><DD><CODE>classLoader</CODE> - the class-loader from which we should create the bean. If this is null, then the system class-loader is used.<DD><CODE>beanName</CODE> - the name of the bean within the class-loader. For example "sun.beanbox.foobah"<DD><CODE>beanContext</CODE> - The BeanContext in which to nest the new bean<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></CODE> - if the class of a serialized object could not be found.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.</DL></DD></DL><HR><A NAME="instantiate(java.lang.ClassLoader, java.lang.String, java.beans.beancontext.BeanContext, java.beans.AppletInitializer)"><!-- --></A><H3>instantiate</H3><PRE>public static <A HREF="../../java/lang/Object.html">Object</A> <B>instantiate</B>(<A HREF="../../java/lang/ClassLoader.html">ClassLoader</A> cls, <A HREF="../../java/lang/String.html">String</A> beanName, <A HREF="../../java/beans/beancontext/BeanContext.html">BeanContext</A> beanContext, <A HREF="../../java/beans/AppletInitializer.html">AppletInitializer</A> initializer) throws <A HREF="../../java/io/IOException.html">IOException</A>, <A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></PRE><DL><DD>Instantiate a bean. <p> The bean is created based on a name relative to a class-loader. This name should be a dot-separated name such as "a.b.c". <p> In Beans 1.0 the given name can indicate either a serialized object or a class. Other mechanisms may be added in the future. In beans 1.0 we first try to treat the beanName as a serialized object name then as a class name. <p> When using the beanName as a serialized object name we convert the given beanName to a resource pathname and add a trailing ".ser" suffix. We then try to load a serialized object from that resource. <p> For example, given a beanName of "x.y", Beans.instantiate would first try to read a serialized object from the resource "x/y.ser" and if that failed it would try to load the class "x.y" and create an instance of that class. <p> If the bean is a subtype of java.applet.Applet, then it is given some special initialization. First, it is supplied with a default AppletStub and AppletContext. Second, if it was instantiated from a classname the applet's "init" method is called. (If the bean was deserialized this step is skipped.) <p> Note that for beans which are applets, it is the caller's responsiblity to call "start" on the applet. For correct behaviour, this should be done after the applet has been added into a visible AWT container. <p> Note that applets created via beans.instantiate run in a slightly different environment than applets running inside browsers. In particular, bean applets have no access to "parameters", so they may wish to provide property get/set methods to set parameter values. We advise bean-applet developers to test their bean-applets against both the SDK appletviewer (for a reference browser environment) and the BDK BeanBox (for a reference bean container).<DD><DL><DT><B>Parameters:</B><DD><CODE>classLoader</CODE> - the class-loader from which we should create the bean. If this is null, then the system class-loader is used.<DD><CODE>beanName</CODE> - the name of the bean within the class-loader. For example "sun.beanbox.foobah"<DD><CODE>beanContext</CODE> - The BeanContext in which to nest the new bean<DD><CODE>initializer</CODE> - The AppletInitializer for the new bean<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/ClassNotFoundException.html">ClassNotFoundException</A></CODE> - if the class of a serialized object could not be found.<DD><CODE><A HREF="../../java/io/IOException.html">IOException</A></CODE> - if an I/O error occurs.</DL></DD></DL><HR><A NAME="getInstanceOf(java.lang.Object, java.lang.Class)"><!-- --></A><H3>getInstanceOf</H3><PRE>public static <A HREF="../../java/lang/Object.html">Object</A> <B>getInstanceOf</B>(<A HREF="../../java/lang/Object.html">Object</A> bean, <A HREF="../../java/lang/Class.html">Class</A> targetType)</PRE><DL><DD>From a given bean, obtain an object representing a specified type view of that source object. <p> The result may be the same object or a different object. If the requested target view isn't available then the given bean is returned. <p> This method is provided in Beans 1.0 as a hook to allow the addition of more flexible bean behaviour in the future.<DD><DL><DT><B>Parameters:</B><DD><CODE>obj</CODE> - Object from which we want to obtain a view.<DD><CODE>targetType</CODE> - The type of view we'd like to get.</DL></DD></DL><HR><A NAME="isInstanceOf(java.lang.Object, java.lang.Class)"><!-- --></A><H3>isInstanceOf</H3><PRE>public static boolean <B>isInstanceOf</B>(<A HREF="../../java/lang/Object.html">Object</A> bean, <A HREF="../../java/lang/Class.html">Class</A> targetType)</PRE><DL><DD>Check if a bean can be viewed as a given target type. The result will be true if the Beans.getInstanceof method can be used on the given bean to obtain an object that represents the specified targetType type view.<DD><DL><DT><B>Parameters:</B><DD><CODE>bean</CODE> - Bean from which we want to obtain a view.<DD><CODE>targetType</CODE> - The type of view we'd like to get.<DT><B>Returns:</B><DD>"true" if the given bean supports the given targetType.</DL></DD></DL><HR><A NAME="isDesignTime()"><!-- --></A><H3>isDesignTime</H3><PRE>public static boolean <B>isDesignTime</B>()</PRE><DL><DD>Test if we are in design-mode.<DD><DL><DT><B>Returns:</B><DD>True if we are running in an application construction environment.<DT><B>See Also: </B><DD><A HREF="../../java/beans/DesignMode.html"><CODE>DesignMode</CODE></A></DL></DD></DL><HR><A NAME="isGuiAvailable()"><!-- --></A><H3>isGuiAvailable</H3><PRE>public static boolean <B>isGuiAvailable</B>()</PRE><DL><DD>Determines whether beans can assume a GUI is available.<DD><DL><DT><B>Returns:</B><DD>True if we are running in an environment where beans can assume that an interactive GUI is available, so they can pop up dialog boxes, etc. This will normally return true in a windowing environment, and will normally return false in a server environment or if an application is running as part of a batch job.<DT><B>See Also: </B><DD><A HREF="../../java/beans/Visibility.html"><CODE>Visibility</CODE></A></DL></DD></DL><HR><A NAME="setDesignTime(boolean)"><!-- --></A><H3>setDesignTime</H3><PRE>public static void <B>setDesignTime</B>(boolean isDesignTime) throws <A HREF="../../java/lang/SecurityException.html">SecurityException</A></PRE><DL><DD>Used to indicate whether of not we are running in an application builder environment. <p>Note that this method is security checked and is not available to (for example) untrusted applets. More specifically, if there is a security manager, its <code>checkPropertiesAccess</code> method is called. This could result in a SecurityException.<DD><DL><DT><B>Parameters:</B><DD><CODE>isDesignTime</CODE> - True if we're in an application builder tool.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkPropertiesAccess</code> method doesn't allow setting of system properties.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkPropertiesAccess()"><CODE>SecurityManager.checkPropertiesAccess()</CODE></A></DL></DD></DL><HR><A NAME="setGuiAvailable(boolean)"><!-- --></A><H3>setGuiAvailable</H3><PRE>public static void <B>setGuiAvailable</B>(boolean isGuiAvailable) throws <A HREF="../../java/lang/SecurityException.html">SecurityException</A></PRE><DL><DD>Used to indicate whether of not we are running in an environment where GUI interaction is available. <p>Note that this method is security checked and is not available to (for example) untrusted applets. More specifically, if there is a security manager, its <code>checkPropertiesAccess</code> method is called. This could result in a SecurityException.<DD><DL><DT><B>Parameters:</B><DD><CODE>isGuiAvailable</CODE> - True if GUI interaction is available.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/SecurityException.html">SecurityException</A></CODE> - if a security manager exists and its <code>checkPropertiesAccess</code> method doesn't allow setting of system properties.<DT><B>See Also: </B><DD><A HREF="../../java/lang/SecurityManager.html#checkPropertiesAccess()"><CODE>SecurityManager.checkPropertiesAccess()</CODE></A></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Beans.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/beans/BeanDescriptor.html"><B>PREV CLASS</B></A> <A HREF="../../java/beans/EventSetDescriptor.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Beans.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -