public class Beans extends Object
Beans provides some methods for manipulting bean
controls.| Constructor and Description |
|---|
Beans()
Constructs a Beans instance.
|
| Modifier and Type | Method and Description |
|---|---|
static Object |
getInstanceOf(Object bean,
Class<?> targetType)
Obtain an alternative type view of the given bean.
|
static Object |
instantiate(ClassLoader loader,
String name)
Obtains an instance of a JavaBean specified the bean name using the
specified class loader.
|
static Object |
instantiate(ClassLoader cls,
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(Object bean,
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 Object instantiate(ClassLoader loader, String name) throws IOException, ClassNotFoundException
If the specified class loader is null, the system class loader is used.
loader - the specified class loader. It can be null.name - the name of the JavaBeanIOExceptionClassNotFoundExceptionpublic static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException
If the specified class loader is null, the system class loader is used.
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.IOExceptionClassNotFoundExceptionpublic static Object getInstanceOf(Object bean, Class<?> targetType)
type.
If the type view cannot be obtained, the original bean object is returned.
bean - the original bean object.targetType - the specified view type.public static boolean isInstanceOf(Object bean, Class<?> targetType)
bean - the specified bean object.targetType - the specifed view type.public static void setGuiAvailable(boolean isGuiAvailable)
throws SecurityException
isGuiAvailable - should be true to signify that a GUI is
available, false otherwise.SecurityException - if the caller does not have the required permission to access
or modify system properties.public static void setDesignTime(boolean isDesignTime)
throws SecurityException
isDesignTime - true to indicate that it's in application construction
environment.SecurityExceptionpublic static boolean isGuiAvailable()
true if a GUI is available, otherwise
false.public static boolean isDesignTime()
Copyright © 2015. All Rights Reserved.