Package jadex.commons.beans
Class Beans
- java.lang.Object
-
- jadex.commons.beans.Beans
-
public class Beans extends java.lang.Object
This classBeans
provides some methods for manipulting bean controls.
-
-
Constructor Summary
Constructors Constructor Description Beans()
Constructs a Beans instance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
instantiate
public static java.lang.Object instantiate(java.lang.ClassLoader loader, java.lang.String name) throws java.io.IOException, java.lang.ClassNotFoundException
Obtains an instance of a JavaBean specified the bean name using the specified class loader.- Parameters:
loader
- the specified class loader. It can be null.name
- the name of the JavaBean- Returns:
- an isntance of the bean.
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
instantiate
public static java.lang.Object instantiate(java.lang.ClassLoader cls, java.lang.String beanName, BeanContext beanContext) throws java.io.IOException, java.lang.ClassNotFoundException
Obtains an instance of a JavaBean specified the bean name using the specified class loader, and adds the instance into the specified bean context.- Parameters:
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.- Returns:
- an instance of the specified JavaBean.
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
getInstanceOf
public static java.lang.Object getInstanceOf(java.lang.Object bean, java.lang.Class<?> targetType)
Obtain an alternative type view of the given bean. The view type is specified by the parametertype
.- Parameters:
bean
- the original bean object.targetType
- the specified view type.- Returns:
- a type view of the given bean.
-
isInstanceOf
public 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.- Parameters:
bean
- the specified bean object.targetType
- the specifed view type.- Returns:
- true if the specified bean object can be viewed as the specified type; otherwise, return false;
-
setGuiAvailable
public static void setGuiAvailable(boolean isGuiAvailable) throws java.lang.SecurityException
Set whether or not a GUI is available in the bean's current environment.- Parameters:
isGuiAvailable
- should betrue
to signify that a GUI is available,false
otherwise.- Throws:
java.lang.SecurityException
- if the caller does not have the required permission to access or modify system properties.
-
setDesignTime
public static void setDesignTime(boolean isDesignTime) throws java.lang.SecurityException
Used to indicate whether of not it's in an application construction environment.- Parameters:
isDesignTime
- true to indicate that it's in application construction environment.- Throws:
java.lang.SecurityException
-
isGuiAvailable
public static boolean isGuiAvailable()
Returns a boolean indication of whether or not a GUI is available for beans.- Returns:
true
if a GUI is available, otherwisefalse
.
-
isDesignTime
public static boolean isDesignTime()
Determine if it's in design-mode.- Returns:
- true if it's in an application construction environment.
-
-