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


Java Bundle.setValue方法代码示例

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


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

示例1: appendColumn

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
public void appendColumn(Bundle bundle, ValueObject value) {
    if (value == null) {
        // bundles measure non-null values in getCount()
        // so appending a null cannot append a column
        throw new IllegalArgumentException("cannot append a null column value");
    }
    checkBinding(bundle);
    BundleField field = null;
    if (bundle.getCount() < fields.length) {
        field = fields[bundle.getCount()];
    } else {
        BundleField[] newFields = new BundleField[fields.length + 1];
        System.arraycopy(fields, 0, newFields, 0, fields.length);
        newFields[newFields.length - 1] = bundle.getFormat().getField(Integer.toString(fields.length));
        fields = newFields;
        field = fields[fields.length - 1];
    }
    bundle.setValue(field, value);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:20,代码来源:BundleColumnBinder.java

示例2: 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);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:21,代码来源:TestBundleColumnBinder.java

示例3: setColumn

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
/** */
public void setColumn(Bundle bundle, int column, ValueObject value) {
    checkBinding(bundle);
    if (column >= fields.length) {
        throw new RuntimeException("invalid column");
    }
    bundle.setValue(fields[column], value);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:9,代码来源:BundleColumnBinder.java

示例4: setAndFilterBundle

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Override protected void setAndFilterBundle(Bundle bundle, SimpleCopyFilter filter) {
    BundleField b = bundle.getFormat().getField("b");
    bundle.setValue(b, ValueFactory.createMap());
    filter.filter(bundle);
    filter.filter(bundle);
    filter.filter(bundle);
    ValueMap subB = bundle.getValue(b).asMap();
    assertEquals("good", subB.get("sub-b").asMap().get("codec").toString());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:10,代码来源:ConstantFieldTest.java

示例5: setKeyFromValue

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test
public void setKeyFromValue() throws Exception {
    SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from.const: foobar, to: MAP/mykey");
    Bundle b = new ListBundle();
    ValueMap map = ValueFactory.createMap();
    b.setValue(b.getFormat().getField("MAP"), map);
    b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("blah"));
    filter.filter(b);
    assertEquals("foobar", map.get("mykey").asNative());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:11,代码来源:ConstantFieldTest.java

示例6: replaceKeyFromValue

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test
public void replaceKeyFromValue() throws Exception {
    SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from.const:foobar, to:MAP.mykey");
    Bundle b = new ListBundle();
    ValueMap map = ValueFactory.createMap();
    map.put("mykey",ValueFactory.create("abc"));
    b.setValue(b.getFormat().getField("MAP"), map);
    b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("blah"));
    filter.filter(b);
    assertEquals("foobar", map.get("mykey").asNative());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:12,代码来源:ConstantFieldTest.java

示例7: setAndFilterBundle

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Override protected void setAndFilterBundle(Bundle bundle, SimpleCopyFilter filter) {
    BundleField a = bundle.getFormat().getField("a");
    BundleField b = bundle.getFormat().getField("b");
    bundle.setValue(a, ValueFactory.createValueArray(ImmutableList.of("SANDWICH")));
    bundle.setValue(b, ValueFactory.createMap());
    filter.filter(bundle);
    filter.filter(bundle);
    filter.filter(bundle);
    assertEquals("SANDWICH", bundle.getValue(b).asMap().get("sub-b").toString());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:11,代码来源:FullAutoFieldTest.java

示例8: setKey

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test
public void setKey() throws Exception {
    SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from: MYFIELD, to: MAP.mykey");
    Bundle b = new ListBundle();
    ValueMap map = ValueFactory.createMap();
    b.setValue(b.getFormat().getField("MAP"), map);
    b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("foobar"));
    filter.filter(b);
    assertEquals("foobar", map.get("mykey").asNative());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:11,代码来源:FullAutoFieldTest.java

示例9: replaceKey

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test
public void replaceKey() throws Exception {
    SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from: MYFIELD, to: MAP.mykey");
    Bundle b = new ListBundle();
    ValueMap map = ValueFactory.createMap();
    map.put("mykey",ValueFactory.create("abc"));
    b.setValue(b.getFormat().getField("MAP"), map);
    b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("foobar"));
    filter.filter(b);
    assertEquals("foobar", map.get("mykey").asNative());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:12,代码来源:FullAutoFieldTest.java

示例10: notMap

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Test(expected = Exception.class)
public void notMap() throws Exception {
    SimpleCopyFilter filter = Configs.decodeObject(SimpleCopyFilter.class, "from: MYFIELD, to:MAP.mykey");
    Bundle b = new ListBundle();
    b.setValue(b.getFormat().getField("MYFIELD"), ValueFactory.create("blah"));
    filter.filter(b);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:8,代码来源:FullAutoFieldTest.java

示例11: setAndFilterBundle

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
protected void setAndFilterBundle(Bundle bundle, SimpleCopyFilter filter) {
    BundleField a = bundle.getFormat().getField("a");
    BundleField b = bundle.getFormat().getField("b");
    bundle.setValue(a, ValueFactory.create("SANDWICH"));
    filter.filter(bundle);
    filter.filter(bundle);
    filter.filter(bundle);
    assertEquals("SANDWICH", bundle.getValue(b).toString());
}
 
开发者ID:addthis,项目名称:bundle,代码行数:10,代码来源:AutoFieldTest.java

示例12: setValue

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Override public void setValue(Bundle bundle, @Nullable ValueObject value) {
    bundle.setValue(field, value);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:4,代码来源:IndexField.java

示例13: setValue

import com.addthis.bundle.core.Bundle; //导入方法依赖的package包/类
@Override public void setValue(Bundle bundle, @Nullable ValueObject value) {
    BundleField field = checkAndGet(bundle);
    bundle.setValue(field, value);
}
 
开发者ID:addthis,项目名称:bundle,代码行数:5,代码来源:CachingField.java


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