com.caucho.util
Class BeanUtil

java.lang.Object
  |
  +--com.caucho.util.BeanUtil

public class BeanUtil
extends java.lang.Object

Bean utilities.


Constructor Summary
BeanUtil()
           
 
Method Summary
static java.lang.Object configure(java.lang.Object obj, RegistryNode config)
          Configure but allow implicit init-param.
static java.lang.Object configure(java.lang.Object obj, RegistryNode config, java.util.HashMap pathVariableMap, Path pwd, boolean allowImplicit, boolean isRequired)
          Sets the properties for a bean by calling setXXX for each init-param.
static java.lang.Object configureOptional(java.lang.Object obj, RegistryNode config)
          Configure but allow implicit init-param.
static java.lang.Object createBean(RegistryNode node, java.util.HashMap variableMap, Path pwd)
          Instantiate and configure a bean.
static java.lang.Object createBean(RegistryNode node, java.util.HashMap variableMap, Path pwd, java.lang.String className)
          Instantiate and configure a bean.
static java.lang.reflect.Method getGetMethod(java.beans.BeanInfo info, java.lang.String propertyName)
          Returns a set method matching the property name.
static java.lang.reflect.Method getGetMethod(java.lang.Class cl, java.lang.String propertyName)
          Returns a get method matching the property name.
static java.lang.reflect.Method getGetMethod(java.lang.Class cl, java.lang.String propertyName, boolean ignoreCase)
          Returns a get method matching the property name.
static java.lang.reflect.Method getSetMethod(java.beans.BeanInfo info, java.lang.String propertyName)
          Returns a set method matching the property name.
static java.lang.reflect.Method getSetMethod(java.lang.Class cl, java.lang.String propertyName)
          Returns a set method matching the property name.
static java.lang.reflect.Method getSetMethod(java.lang.Class cl, java.lang.String propertyName, boolean ignoreCase)
          Returns a set method matching the property name.
static java.lang.Object instantiate(RegistryNode node, java.lang.String className)
           
static Path lookupPath(java.lang.String pathName, java.util.HashMap varMap, Path pwd)
          Returns the native path for a configured path name.
static java.lang.String methodNameToPropertyName(java.beans.BeanInfo info, java.lang.String methodName)
          Converts a user's property name to a bean method name.
static java.lang.String methodNameToPropertyName(java.lang.String methodName)
          Converts a user's property name to a bean method name.
static java.lang.String propertyNameToMethodName(java.lang.String propertyName)
          Converts a user's property name to a bean method name.
static void setBeanProperty(java.lang.Object obj, java.lang.String name, java.lang.String value)
          Configures a single bean property.
static void setBeanProperty(java.lang.Object obj, java.lang.String name, java.lang.String value, java.beans.BeanInfo info, RegistryNode config, java.util.HashMap pathVariableMap, Path pwd, boolean isRequired)
          Configures a single bean property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanUtil

public BeanUtil()
Method Detail

createBean

public static java.lang.Object createBean(RegistryNode node,
                                          java.util.HashMap variableMap,
                                          Path pwd)
                                   throws RegistryException
Instantiate and configure a bean.

createBean

public static java.lang.Object createBean(RegistryNode node,
                                          java.util.HashMap variableMap,
                                          Path pwd,
                                          java.lang.String className)
                                   throws RegistryException
Instantiate and configure a bean.

instantiate

public static java.lang.Object instantiate(RegistryNode node,
                                           java.lang.String className)
                                    throws RegistryException

configure

public static java.lang.Object configure(java.lang.Object obj,
                                         RegistryNode config)
                                  throws RegistryException
Configure but allow implicit init-param.

configureOptional

public static java.lang.Object configureOptional(java.lang.Object obj,
                                                 RegistryNode config)
                                          throws RegistryException
Configure but allow implicit init-param.

configure

public static java.lang.Object configure(java.lang.Object obj,
                                         RegistryNode config,
                                         java.util.HashMap pathVariableMap,
                                         Path pwd,
                                         boolean allowImplicit,
                                         boolean isRequired)
                                  throws RegistryException
Sets the properties for a bean by calling setXXX for each init-param.
Parameters:
object - the bean
config - the resin.conf configuration node

setBeanProperty

public static void setBeanProperty(java.lang.Object obj,
                                   java.lang.String name,
                                   java.lang.String value)
                            throws RegistryException
Configures a single bean property.
Parameters:
obj - the bean to configure
config - the configuration node (for error messages)
name - the property name
value - the property name

setBeanProperty

public static void setBeanProperty(java.lang.Object obj,
                                   java.lang.String name,
                                   java.lang.String value,
                                   java.beans.BeanInfo info,
                                   RegistryNode config,
                                   java.util.HashMap pathVariableMap,
                                   Path pwd,
                                   boolean isRequired)
                            throws RegistryException
Configures a single bean property.
Parameters:
obj - the bean to configure
name - the property name
value - the property value
info - the bean's introspected info
config - the configuration node (for error messages)

lookupPath

public static Path lookupPath(java.lang.String pathName,
                              java.util.HashMap varMap,
                              Path pwd)
Returns the native path for a configured path name. The special cases $app-dir and $resin-home specify the root directory.
Parameters:
pathName - the configuration path name.
varMap - the map of path variables.
pwd - the default path.
Returns:
a real path corresponding to the path name

getSetMethod

public static java.lang.reflect.Method getSetMethod(java.beans.BeanInfo info,
                                                    java.lang.String propertyName)
Returns a set method matching the property name.

getSetMethod

public static java.lang.reflect.Method getSetMethod(java.lang.Class cl,
                                                    java.lang.String propertyName)
Returns a set method matching the property name.

getSetMethod

public static java.lang.reflect.Method getSetMethod(java.lang.Class cl,
                                                    java.lang.String propertyName,
                                                    boolean ignoreCase)
Returns a set method matching the property name.

getGetMethod

public static java.lang.reflect.Method getGetMethod(java.beans.BeanInfo info,
                                                    java.lang.String propertyName)
Returns a set method matching the property name.

getGetMethod

public static java.lang.reflect.Method getGetMethod(java.lang.Class cl,
                                                    java.lang.String propertyName)
Returns a get method matching the property name.

getGetMethod

public static java.lang.reflect.Method getGetMethod(java.lang.Class cl,
                                                    java.lang.String propertyName,
                                                    boolean ignoreCase)
Returns a get method matching the property name.

propertyNameToMethodName

public static java.lang.String propertyNameToMethodName(java.lang.String propertyName)
Converts a user's property name to a bean method name.
Parameters:
propertyName - the user property name
Returns:
the equivalent bean method name

methodNameToPropertyName

public static java.lang.String methodNameToPropertyName(java.beans.BeanInfo info,
                                                        java.lang.String methodName)
Converts a user's property name to a bean method name.
Parameters:
methodName - the method name
Returns:
the equivalent property name

methodNameToPropertyName

public static java.lang.String methodNameToPropertyName(java.lang.String methodName)
Converts a user's property name to a bean method name.
Parameters:
methodName - the method name
Returns:
the equivalent property name