<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Class java.beans.Beans
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.beans.html">This Package</a>  <a href="java.beans.BeanDescriptor.html#_top_">Previous</a>  <a href="java.beans.EventSetDescriptor.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Class java.beans.Beans
</h1>
<pre>
<a href="java.lang.Object.html#_top_">java.lang.Object</a>
   |
   +----java.beans.Beans
</pre>
<hr>
<dl>
  <dt> public class <b>Beans</b>
  <dt> extends <a href="java.lang.Object.html#_top_">Object</a>
</dl>
This class provides some general purpose beans control methods.
<p>
<hr>
<a name="index"></a>
<h2>
  <img src="images/constructor-index.gif" width=275 height=38 alt="Constructor Index">
</h2>
<dl>
  <dt> <img src="images/yellow-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#Beans()"><b>Beans</b></a>()
  <dd> 
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getInstanceOf(java.lang.Object, java.lang.Class)"><b>getInstanceOf</b></a>(Object, Class)
  <dd>  From a given bean, obtain an object representing a specified
 type view of that source object.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#instantiate(java.lang.ClassLoader, java.lang.String)"><b>instantiate</b></a>(ClassLoader, String)
  <dd>  Instantiate a bean.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isDesignTime()"><b>isDesignTime</b></a>()
  <dd>  Test if we are in design-mode.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isGuiAvailable()"><b>isGuiAvailable</b></a>()
  <dd>  
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#isInstanceOf(java.lang.Object, java.lang.Class)"><b>isInstanceOf</b></a>(Object, Class)
  <dd>  Check if a bean can be viewed as a given target type.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setDesignTime(boolean)"><b>setDesignTime</b></a>(boolean)
  <dd>  Used to indicate whether of not we are running in an application
 builder environment.
  <dt> <img src="images/green-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setGuiAvailable(boolean)"><b>setGuiAvailable</b></a>(boolean)
  <dd>  Used to indicate whether of not we are running in an environment
 where GUI interaction is available.
</dl>
<a name="constructors"></a>
<h2>
  <img src="images/constructors.gif" width=231 height=38 alt="Constructors">
</h2>
<a name="Beans"></a>
<a name="Beans()"><img src="images/yellow-ball.gif" width=12 height=12 alt=" o "></a>
<b>Beans</b>
<pre>
 public Beans()
</pre>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="instantiate(java.lang.ClassLoader, java.lang.String)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="instantiate"><b>instantiate</b></a>
<pre>
 public static <a href="java.lang.Object.html#_top_">Object</a> instantiate(<a href="java.lang.ClassLoader.html#_top_">ClassLoader</a> cls,
                                  <a href="java.lang.String.html#_top_">String</a> beanName) throws <a href="java.io.IOException.html#_top_">IOException</a>, <a href="java.lang.ClassNotFoundException.html#_top_">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 JDK appletviewer (for a reference browser environment) and the
 BDK BeanBox (for a reference bean container).
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> classLoader - the class-loader from which we should create
 		              the bean.  If this is null, then the system
                        class-loader is used.
    <dd> beanName - the name of the bean within the class-loader.
   	              For example "sun.beanbox.foobah"
    <dt> <b>Throws:</b> <a href="java.lang.ClassNotFoundException.html#_top_">ClassNotFoundException</a>
    <dd> if the class of a serialized
              object could not be found.
    <dt> <b>Throws:</b> <a href="java.io.IOException.html#_top_">IOException</a>
    <dd> if an I/O error occurs.
  </dl></dd>
</dl>
<a name="getInstanceOf(java.lang.Object, java.lang.Class)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getInstanceOf"><b>getInstanceOf</b></a>
<pre>
 public static <a href="java.lang.Object.html#_top_">Object</a> getInstanceOf(<a href="java.lang.Object.html#_top_">Object</a> bean,
                                    <a href="java.lang.Class.html#_top_">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.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> obj - Object from which we want to obtain a view.
    <dd> targetType - The type of view we'd like to get.
  </dl></dd>
</dl>
<a name="isInstanceOf(java.lang.Object, java.lang.Class)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isInstanceOf"><b>isInstanceOf</b></a>
<pre>
 public static boolean isInstanceOf(<a href="java.lang.Object.html#_top_">Object</a> bean,
                                    <a href="java.lang.Class.html#_top_">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.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> bean - Bean from which we want to obtain a view.
    <dd> targetType - 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>
<a name="isDesignTime()"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isDesignTime"><b>isDesignTime</b></a>
<pre>
 public static boolean isDesignTime()
</pre>
<dl>
  <dd> Test if we are in design-mode.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> True if we are running in an application construction
		environment.
  </dl></dd>
</dl>
<a name="isGuiAvailable()"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="isGuiAvailable"><b>isGuiAvailable</b></a>
<pre>
 public static boolean isGuiAvailable()
</pre>
<dl>
  <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.
  </dl></dd>
</dl>
<a name="setDesignTime(boolean)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setDesignTime"><b>setDesignTime</b></a>
<pre>
 public static void setDesignTime(boolean isDesignTime) throws <a href="java.lang.SecurityException.html#_top_">SecurityException</a>
</pre>
<dl>
  <dd> Used to indicate whether of not we are running in an application
 builder environment.  Note that this method is security checked
 and is not available to (for example) untrusted applets.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> isDesignTime - True if we're in an application builder tool.
  </dl></dd>
</dl>
<a name="setGuiAvailable(boolean)"><img src="images/green-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setGuiAvailable"><b>setGuiAvailable</b></a>
<pre>
 public static void setGuiAvailable(boolean isGuiAvailable) throws <a href="java.lang.SecurityException.html#_top_">SecurityException</a>
</pre>
<dl>
  <dd> Used to indicate whether of not we are running in an environment
 where GUI interaction is available.  Note that this method is 
 security checked and is not available to (for example) untrusted
 applets.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> isGuiAvailable - True if GUI interaction is available.
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.beans.html">This Package</a>  <a href="java.beans.BeanDescriptor.html#_top_">Previous</a>  <a href="java.beans.EventSetDescriptor.html#_top_">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
