public class Beans
extends java.lang.Object
Beans
provides some methods for manipulting bean
controls.Constructor and Description |
---|
Beans()
Constructs a Beans instance.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
getInstanceOf(java.lang.Object bean,
java.lang.Class<?> targetType)
Obtain an alternative type view of the given bean.
|
static java.lang.Object |
instantiate(java.lang.ClassLoader loader,
java.lang.String name)
Obtains an instance of a JavaBean specified the bean name using the
specified class loader.
|
static java.lang.Object |
instantiate(java.lang.ClassLoader cls,
java.lang.String beanName,
BeanContext beanContext)
Obtains an instance of a JavaBean specified the bean name using the
specified class loader, and adds the instance into the specified bean
context.
|
static boolean |
isDesignTime()
Determine if it's in design-mode.
|
static boolean |
isGuiAvailable()
Returns a boolean indication of whether or not a GUI is available for
beans.
|
static boolean |
isInstanceOf(java.lang.Object bean,
java.lang.Class<?> targetType)
Determine if the the specified bean object can be viewed as the specified
type.
|
static void |
setDesignTime(boolean isDesignTime)
Used to indicate whether of not it's in an application construction
environment.
|
static void |
setGuiAvailable(boolean isGuiAvailable)
Set whether or not a GUI is available in the bean's current environment.
|
public static java.lang.Object instantiate(java.lang.ClassLoader loader, java.lang.String name) throws java.io.IOException, java.lang.ClassNotFoundException
loader
- the specified class loader. It can be null.name
- the name of the JavaBeanjava.io.IOException
java.lang.ClassNotFoundException
public static java.lang.Object instantiate(java.lang.ClassLoader cls, java.lang.String beanName, BeanContext beanContext) throws java.io.IOException, java.lang.ClassNotFoundException
cls
- the specified class loader. It can be null.beanName
- the name of the JavaBeanbeanContext
- the beancontext in which the bean instance will be added.java.io.IOException
java.lang.ClassNotFoundException
public static java.lang.Object getInstanceOf(java.lang.Object bean, java.lang.Class<?> targetType)
type
.
bean
- the original bean object.targetType
- the specified view type.public static boolean isInstanceOf(java.lang.Object bean, java.lang.Class<?> targetType)
bean
- the specified bean object.targetType
- the specifed view type.public static void setGuiAvailable(boolean isGuiAvailable) throws java.lang.SecurityException
isGuiAvailable
- should be true
to signify that a GUI is
available, false
otherwise.java.lang.SecurityException
- if the caller does not have the required permission to access
or modify system properties.public static void setDesignTime(boolean isDesignTime) throws java.lang.SecurityException
isDesignTime
- true to indicate that it's in application construction
environment.java.lang.SecurityException
public static boolean isGuiAvailable()
true
if a GUI is available, otherwise
false
.public static boolean isDesignTime()