当前位置: 首页>>代码示例>>Java>>正文


Java DynaBean.getDynaClass方法代码示例

本文整理汇总了Java中org.apache.commons.beanutils.DynaBean.getDynaClass方法的典型用法代码示例。如果您正苦于以下问题:Java DynaBean.getDynaClass方法的具体用法?Java DynaBean.getDynaClass怎么用?Java DynaBean.getDynaClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.beanutils.DynaBean的用法示例。


在下文中一共展示了DynaBean.getDynaClass方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDynaClass

import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
 * Returns the {@link SqlDynaClass} for the given bean.
 * 
 * @param dynaBean The bean
 * @return The dyna bean class
 */
public SqlDynaClass getDynaClass(DynaBean dynaBean) throws SqlDynaException
{
    DynaClass dynaClass = dynaBean.getDynaClass();

    if (dynaClass instanceof SqlDynaClass)
    {
        return (SqlDynaClass)dynaClass;
    }
    else
    {
        // TODO: we could autogenerate an SqlDynaClass here ?
        throw new SqlDynaException("The dyna bean is not an instance of a SqlDynaClass");
    }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:21,代码来源:DynaClassCache.java

示例2: createActionForm

import org.apache.commons.beanutils.DynaBean; //导入方法依赖的package包/类
/**
 * <p>Create and return an <code>ActionForm</code> instance appropriate to
 * the information in this <code>FormBeanConfig</code>.</p>
 *
 * <p>Although this method is not formally deprecated yet, where possible,
 * the form which accepts an <code>ActionContext</code> as an argument is
 * preferred, to help sever direct dependencies on the Servlet API.  As
 * the ActionContext becomes more familiar in Struts, this method will
 * almost certainly be deprecated.</p>
 *
 * @param servlet The action servlet
 * @return ActionForm instance
 * @throws IllegalAccessException if the Class or the appropriate
 *                                constructor is not accessible
 * @throws InstantiationException if this Class represents an abstract
 *                                class, an array class, a primitive type,
 *                                or void; or if instantiation fails for
 *                                some other reason
 */
public ActionForm createActionForm(ActionServlet servlet)
    throws IllegalAccessException, InstantiationException {
    Object obj = null;

    // Create a new form bean instance
    if (getDynamic()) {
        obj = getDynaActionFormClass().newInstance();
    } else {
        obj = formBeanClass().newInstance();
    }

    ActionForm form = null;

    if (obj instanceof ActionForm) {
        form = (ActionForm) obj;
    } else {
        form = new BeanValidatorForm(obj);
    }

    form.setServlet(servlet);

    if (form instanceof DynaBean
        && ((DynaBean) form).getDynaClass() instanceof MutableDynaClass) {
        DynaBean dynaBean = (DynaBean) form;
        MutableDynaClass dynaClass =
            (MutableDynaClass) dynaBean.getDynaClass();

        // Add properties
        dynaClass.setRestricted(false);

        FormPropertyConfig[] props = findFormPropertyConfigs();

        for (int i = 0; i < props.length; i++) {
            dynaClass.add(props[i].getName(), props[i].getTypeClass());
            dynaBean.set(props[i].getName(), props[i].initial());
        }

        dynaClass.setRestricted(isRestricted());
    }

    if (form instanceof BeanValidatorForm) {
        ((BeanValidatorForm)form).initialize(this);
    }

    return form;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:66,代码来源:FormBeanConfig.java


注:本文中的org.apache.commons.beanutils.DynaBean.getDynaClass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。