Class java.beans.Beans
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.beans.Beans

java.lang.Object
   |
   +----java.beans.Beans

public class Beans
extends Object
This class provides some general purpose beans control methods.

Constructor Index

 o Beans()

Method Index

 o getInstanceOf(Object, Class)
From a given bean, obtain an object representing a specified type view of that source object.
 o instantiate(ClassLoader, String)
Read in a bean from a serialized object.
 o isDesignTime()
 o isGuiAvailable()
 o isInstanceOf(Object, Class)
Check if a bean can be viewed as a given target type.
 o setDesignTime(boolean)
Used to indicate whether of not we are running in an application builder environment.
 o setGuiAvailable(boolean)
Used to indicate whether of not we are running in an environment where GUI interaction is available.

Constructors

 o Beans
  public Beans()

Methods

 o instantiate
  public static Object instantiate(ClassLoader cls,
                                   String name) throws IOException, ClassNotFoundException
Read in a bean from a serialized object. The serialized object is a named resource file available from a given class-loader.
Parameters:
classLoader - The class-loader from which we should read the serialized object. If this is null then the system class-loader is used.
name - This names the serialized object within the class-loader. For example "sun/beanbox/foobah.ser"
 o getInstanceOf
  public static Object getInstanceOf(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. 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:
obj - Object from which we want to obtain a view.
targetType - The type of view we'd like to get.
 o isInstanceOf
  public static boolean isInstanceOf(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.
targetType - The type of view we'd like to get.
Returns:
"true" if the given bean supports the given targetType.
 o isDesignTime
  public static boolean isDesignTime()
Returns:
True if we are running in an application construction environment.
 o isGuiAvailable
  public static boolean isGuiAvailable()
Returns:
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.
 o setDesignTime
  public static void setDesignTime(boolean isDesignTime) throws SecurityException
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.
Parameters:
isDesignTime - True if we're in an application builder tool.
 o setGuiAvailable
  public static void setGuiAvailable(boolean isGuiAvailable) throws SecurityException
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.
Parameters:
isGuiAvailable - True if GUI interaction is available.

All Packages  Class Hierarchy  This Package  Previous  Next  Index