本文整理汇总了Java中org.apache.commons.beanutils.BasicDynaClass类的典型用法代码示例。如果您正苦于以下问题:Java BasicDynaClass类的具体用法?Java BasicDynaClass怎么用?Java BasicDynaClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasicDynaClass类属于org.apache.commons.beanutils包,在下文中一共展示了BasicDynaClass类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: objectArrayToBean
import org.apache.commons.beanutils.BasicDynaClass; //导入依赖的package包/类
/**
* 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;
}
开发者ID:alejandro-du,项目名称:enterprise-app,代码行数:26,代码来源:DefaultHbnContainer.java
示例2: setUp
import org.apache.commons.beanutils.BasicDynaClass; //导入依赖的package包/类
@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);
}
开发者ID:strator-dev,项目名称:greenpepper,代码行数:11,代码来源:DynaBeanFixtureTest.java
示例3: addValue
import org.apache.commons.beanutils.BasicDynaClass; //导入依赖的package包/类
/**
* 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);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:BeanListUnivariateImpl.java
示例4: addValue
import org.apache.commons.beanutils.BasicDynaClass; //导入依赖的package包/类
/**
* 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);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:BeanListUnivariateImpl.java
示例5: createDynaClass
import org.apache.commons.beanutils.BasicDynaClass; //导入依赖的package包/类
protected DynaClass createDynaClass()
{
DynaClass dynaClass = new BasicDynaClass
("TestDynaClass", null,
new DynaProperty[]{
new DynaProperty("name", String.class),
});
return (dynaClass);
}
开发者ID:KualiCo,项目名称:ojb,代码行数:10,代码来源:PersistentFieldTest.java
注:本文中的org.apache.commons.beanutils.BasicDynaClass类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论