Java Doc for Beans.java in  » 6.0-JDK-Core » beans » java » beans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » beans » java.beans 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.beans.Beans

Beans
public class Beans (Code)
This class provides some general purpose beans control methods.




Method Summary
public static  ObjectgetInstanceOf(Object bean, Class targetType)
     From a given bean, obtain an object representing a specified type view of that source object.

The result may be the same object or a different object.

public static  Objectinstantiate(ClassLoader cls, String beanName)
    

Instantiate a JavaBean.


Parameters:
  cls - the class-loader from which we should createthe bean.
public static  Objectinstantiate(ClassLoader cls, String beanName, BeanContext beanContext)
    

Instantiate a JavaBean.


Parameters:
  cls - the class-loader from which we should createthe bean.
public static  Objectinstantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
     Instantiate a bean.

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.

public static  booleanisDesignTime()
     Test if we are in design-mode.
public static  booleanisGuiAvailable()
     Determines whether beans can assume a GUI is available. True if we are running in an environment where beanscan assume that an interactive GUI is available, so theycan pop up dialog boxes, etc.
public static  booleanisInstanceOf(Object bean, Class targetType)
     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.
Parameters:
  bean - Bean from which we want to obtain a view.
Parameters:
  targetType - The type of view we'd like to get.
public static  voidsetDesignTime(boolean isDesignTime)
     Used to indicate whether of not we are running in an application builder environment.
public static  voidsetGuiAvailable(boolean isGuiAvailable)
     Used to indicate whether of not we are running in an environment where GUI interaction is available.



Method Detail
getInstanceOf
public static Object getInstanceOf(Object bean, Class targetType)(Code)
From a given bean, obtain an object representing a specified type view of that source object.

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.

This method is provided in Beans 1.0 as a hook to allow the addition of more flexible bean behaviour in the future.
Parameters:
  bean - Object from which we want to obtain a view.
Parameters:
  targetType - The type of view we'd like to get.




instantiate
public static Object instantiate(ClassLoader cls, String beanName) throws java.io.IOException, ClassNotFoundException(Code)

Instantiate a JavaBean.


Parameters:
  cls - the class-loader from which we should createthe bean. If this is null, then the systemclass-loader is used.
Parameters:
  beanName - the name of the bean within the class-loader.For example "sun.beanbox.foobah"
exception:
  java.lang.ClassNotFoundException - if the class of a serializedobject could not be found.
exception:
  java.io.IOException - if an I/O error occurs.



instantiate
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException(Code)

Instantiate a JavaBean.


Parameters:
  cls - the class-loader from which we should createthe bean. If this is null, then the systemclass-loader is used.
Parameters:
  beanName - the name of the bean within the class-loader.For example "sun.beanbox.foobah"
Parameters:
  beanContext - The BeanContext in which to nest the new bean
exception:
  java.lang.ClassNotFoundException - if the class of a serializedobject could not be found.
exception:
  java.io.IOException - if an I/O error occurs.



instantiate
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer) throws java.io.IOException, ClassNotFoundException(Code)
Instantiate a bean.

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 JDK appletviewer (for a reference browser environment) and the BDK BeanBox (for a reference bean container).
Parameters:
  cls - the class-loader from which we should createthe bean. If this is null, then the systemclass-loader is used.
Parameters:
  beanName - the name of the bean within the class-loader.For example "sun.beanbox.foobah"
Parameters:
  beanContext - The BeanContext in which to nest the new bean
Parameters:
  initializer - The AppletInitializer for the new bean
exception:
  java.lang.ClassNotFoundException - if the class of a serializedobject could not be found.
exception:
  java.io.IOException - if an I/O error occurs.




isDesignTime
public static boolean isDesignTime()(Code)
Test if we are in design-mode. True if we are running in an application constructionenvironment.
See Also:   java.beans.DesignMode



isGuiAvailable
public static boolean isGuiAvailable()(Code)
Determines whether beans can assume a GUI is available. True if we are running in an environment where beanscan assume that an interactive GUI is available, so theycan pop up dialog boxes, etc. This will normally returntrue in a windowing environment, and will normally returnfalse in a server environment or if an application isrunning as part of a batch job.
See Also:   java.beans.Visibility



isInstanceOf
public static boolean isInstanceOf(Object bean, Class targetType)(Code)
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.
Parameters:
  bean - Bean from which we want to obtain a view.
Parameters:
  targetType - The type of view we'd like to get. "true" if the given bean supports the given targetType.



setDesignTime
public static void setDesignTime(boolean isDesignTime) throws SecurityException(Code)
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. More specifically, if there is a security manager, its checkPropertiesAccess method is called. This could result in a SecurityException.
Parameters:
  isDesignTime - True if we're in an application builder tool.
exception:
  SecurityException - if a security manager exists and its checkPropertiesAccess method doesn't allow settingof system properties.
See Also:   SecurityManager.checkPropertiesAccess




setGuiAvailable
public static void setGuiAvailable(boolean isGuiAvailable) throws SecurityException(Code)
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. More specifically, if there is a security manager, its checkPropertiesAccess method is called. This could result in a SecurityException.
Parameters:
  isGuiAvailable - True if GUI interaction is available.
exception:
  SecurityException - if a security manager exists and its checkPropertiesAccess method doesn't allow settingof system properties.
See Also:   SecurityManager.checkPropertiesAccess




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.