Java 类org.apache.commons.beanutils.BasicDynaClass 实例源码

项目:enterprise-app    文件:DefaultHbnContainer.java   
/**
 * Constructs a DynaBean using the values and properties specified. 
 * @param values property values.
 * @param properties properties to add to the bean.
 * @param classes properties types.
 * @return DynBean with the values and properties specified.
 */
protected DynaBean objectArrayToBean(Object[] values, String[] properties, Class<?>[] classes) {
    DynaBean dynaBean = null;

    try {
        DynaProperty[] columnsDynaProperties = getColumnsDynaProperties(properties, classes);
        BasicDynaClass clazz = new BasicDynaClass(this.getClass().getSimpleName(), BasicDynaBean.class, columnsDynaProperties);
        dynaBean = clazz.newInstance();

        for(int i = 0; i < columnsDynaProperties.length; i++) {
            dynaBean.set(columnsDynaProperties[i].getName(), values[i]);
        }

    } catch (Exception e) {
        throw new RuntimeException("Error creating dynamic bean", e);
    }

    return dynaBean;
}
项目:greenpepper    文件:DynaBeanFixtureTest.java   
@Override
     protected void setUp() throws Exception {
         target = new BasicDynaBean(new BasicDynaClass("target", null, new DynaProperty[] {
                 new DynaProperty("string", String.class),
                 new DynaProperty("integer", int.class)
         }));

decorated = context.mock(Fixture.class);
         fixture = new DynaBeanFixture(decorated);
     }
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, new Double(v));
    addObject(dynaBean);
}
项目:astor    文件:BeanListUnivariateImpl.java   
/**
  *  Creates a {@link org.apache.commons.beanutils.DynaBean} with a 
  *  {@link org.apache.commons.beanutils.DynaProperty} named 
  *  <code>propertyName,</code> sets the value of the property to <code>v</code>
  *  and adds the DynaBean to the underlying list.
  *
  */
public void addValue(double v)  {
    DynaProperty[] props = new DynaProperty[] {
            new DynaProperty(propertyName, Double.class)
    };
    BasicDynaClass dynaClass = new BasicDynaClass(null, null, props);
    DynaBean dynaBean = null;
    try {
        dynaBean = dynaClass.newInstance();
    } catch (Exception ex) {              // InstantiationException, IllegalAccessException
        throw new RuntimeException(ex);   // should never happen
    }
    dynaBean.set(propertyName, Double.valueOf(v));
    addObject(dynaBean);
}
项目:ojb    文件:PersistentFieldTest.java   
protected DynaClass createDynaClass()
{
    DynaClass dynaClass = new BasicDynaClass
            ("TestDynaClass", null,
                    new DynaProperty[]{
                        new DynaProperty("name", String.class),
                    });
    return (dynaClass);
}