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.
-
Beans()
-
-
getInstanceOf(Object, Class)
- From a given bean, obtain an object representing a specified
type view of that source object.
-
instantiate(ClassLoader, String)
- Read in a bean from a serialized object.
-
isDesignTime()
-
-
isGuiAvailable()
-
-
isInstanceOf(Object, Class)
- Check if a bean can be viewed as a given target type.
-
setDesignTime(boolean)
- Used to indicate whether of not we are running in an application
builder environment.
-
setGuiAvailable(boolean)
- Used to indicate whether of not we are running in an environment
where GUI interaction is available.
Beans
public Beans()
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"
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.
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.
isDesignTime
public static boolean isDesignTime()
- Returns:
- True if we are running in an application construction
environment.
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.
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.
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