本文整理汇总了Java中com.addthis.bundle.core.Bundle.getFormat方法的典型用法代码示例。如果您正苦于以下问题:Java Bundle.getFormat方法的具体用法?Java Bundle.getFormat怎么用?Java Bundle.getFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.addthis.bundle.core.Bundle
的用法示例。
在下文中一共展示了Bundle.getFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBundleColumnBinder1
import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test
public void testBundleColumnBinder1() {
Bundle b1 = new ListBundle();
BundleColumnBinder binder = new BundleColumnBinder(b1);
b1.setValue(b1.getFormat().getField("abc"), ValueFactory.create("def"));
b1.setValue(b1.getFormat().getField("ghi"), ValueFactory.create("jkl"));
b1.setValue(b1.getFormat().getField("mno"), ValueFactory.create("pqr"));
assertEquals(binder.getColumn(b1, 1), ValueFactory.create("jkl"));
assertEquals(binder.getColumn(b1, 2), ValueFactory.create("pqr"));
assertEquals(binder.getColumn(b1, 0), ValueFactory.create("def"));
assertEquals(binder.getColumn(b1, 3), null);
Bundle b2 = new ListBundle((ListBundleFormat) b1.getFormat());
b2.setValue(b2.getFormat().getField("abc"), ValueFactory.create("def"));
b2.setValue(b2.getFormat().getField("ghi"), ValueFactory.create("jkl"));
b2.setValue(b2.getFormat().getField("mno"), ValueFactory.create("pqr"));
assertEquals(binder.getColumn(b2, 1), ValueFactory.create("jkl"));
assertEquals(binder.getColumn(b2, 2), ValueFactory.create("pqr"));
assertEquals(binder.getColumn(b2, 0), ValueFactory.create("def"));
assertEquals(binder.getColumn(b2, 3), null);
}
示例2: testBundleColumnBinder2
import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test
public void testBundleColumnBinder2() {
Bundle b1 = new ListBundle();
BundleColumnBinder binder = new BundleColumnBinder(b1);
binder.appendColumn(b1, ValueFactory.create("abc"));
binder.appendColumn(b1, ValueFactory.create("def"));
binder.appendColumn(b1, ValueFactory.create("ghi"));
assertEquals(binder.getColumn(b1, 1), ValueFactory.create("def"));
assertEquals(binder.getColumn(b1, 2), ValueFactory.create("ghi"));
assertEquals(binder.getColumn(b1, 0), ValueFactory.create("abc"));
assertEquals(binder.getColumn(b1, 3), null);
Bundle b2 = new ListBundle((ListBundleFormat) b1.getFormat());
binder.appendColumn(b2, ValueFactory.create("abc"));
binder.appendColumn(b2, ValueFactory.create("def"));
binder.appendColumn(b2, ValueFactory.create("ghi"));
binder.appendColumn(b2, ValueFactory.create("jkl"));
assertEquals(binder.getColumn(b2, 1), ValueFactory.create("def"));
assertEquals(binder.getColumn(b2, 2), ValueFactory.create("ghi"));
assertEquals(binder.getColumn(b2, 0), ValueFactory.create("abc"));
assertEquals(binder.getColumn(b2, 3), ValueFactory.create("jkl"));
assertEquals(binder.getColumn(b2, 4), null);
}
示例3: getValue
import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Override
public ValueObject getValue(Bundle bundle) {
if (bundle.getFormat() != lastFormat) {
lastFormat = bundle.getFormat();
lastField = lastFormat.getField(name);
}
return bundle.getValue(lastField);
}