|
JSR 216 (Maintenance Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.beans.Beans
This class provides some general purpose beans control methods.
Constructor Summary | |
Beans()
|
Method Summary | |
static Object |
instantiate(ClassLoader cls,
String beanName)
Instantiate a JavaBean. |
static boolean |
isDesignTime()
Test if we are in design-mode. |
static boolean |
isGuiAvailable()
Determines whether beans can assume a GUI is available. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Beans()
Method Detail |
public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException
Instantiate a JavaBean.
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".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.
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.
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.
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.)
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.
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).
cls
- the class-loader from which we should create
the bean. If this is null, then the system
class-loader is used.beanName
- the name of the bean within the class-loader.
For example "sun.beanbox.foobah"
ClassNotFoundException
- if the class of a serialized
object could not be found.
IOException
- if an I/O error occurs.public static boolean isDesignTime()
This method always returns false
in
this Profile.
public static boolean isGuiAvailable()
Visibility
|
JSR 216 (Maintenance Release) | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ing HTML relocated from here.