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


Java Table.put方法代码示例

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


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

示例1: item

import com.jcabi.dynamo.Table; //导入方法依赖的package包/类
/**
 * The item to work with.
 * @return Item to work with
 * @throws Exception If some problem inside
 */
private static Item item() throws Exception {
    final Region region = new MkRegion(
        new H2Data().with(
            "domains",
            new String[] {"domain"},
            "owner", "usage", "total"
        )
    );
    final Table table = region.table("domains");
    table.put(
        new Attributes()
            .with("domain", "yegor256.com")
            .with("owner", new AttributeValue("yegor256"))
            .with("usage", new AttributeValue("<usage/>"))
            .with("total", new AttributeValue().withN("0"))
    );
    return table.frame()
        .where("domain", "yegor256.com")
        .iterator().next();
}
 
开发者ID:yegor256,项目名称:jare,代码行数:26,代码来源:DyUsageTest.java

示例2: storesAndReadsSingleAttribute

import com.jcabi.dynamo.Table; //导入方法依赖的package包/类
/**
 * MkRegion can store and read items.
 * @throws Exception If some problem inside
 */
@Test
public void storesAndReadsSingleAttribute() throws Exception {
    final String table = "ideas";
    final String key = "number";
    final String attr = "total";
    final Region region = new MkRegion(
        new H2Data().with(table, new String[] {key}, attr)
    );
    final Table tbl = region.table(table);
    tbl.put(
        new Attributes()
            .with(key, "32443")
            .with(attr, "0")
    );
    final Item item = tbl.frame().iterator().next();
    item.put(
        attr,
        new AttributeValueUpdate().withValue(
            new AttributeValue().withN("2")
        ).withAction(AttributeAction.PUT)
    );
    MatcherAssert.assertThat(item.get(attr).getN(), Matchers.equalTo("2"));
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:28,代码来源:MkRegionTest.java

示例3: storesAndReadsAttributes

import com.jcabi.dynamo.Table; //导入方法依赖的package包/类
/**
 * MkRegion can store and read items.
 * @throws Exception If some problem inside
 */
@Test
public void storesAndReadsAttributes() throws Exception {
    final String name = "users";
    final String key = "id";
    final String attr = "description";
    final String nattr = "thenumber";
    final Region region = new MkRegion(
        new H2Data().with(name, new String[] {key}, attr, nattr)
    );
    final Table table = region.table(name);
    table.put(
        new Attributes()
            .with(key, "32443")
            .with(attr, "first value to \n\t€ save")
            .with(nattr, "150")
    );
    final Item item = table.frame().iterator().next();
    MatcherAssert.assertThat(item.has(attr), Matchers.is(true));
    MatcherAssert.assertThat(
        item.get(attr).getS(),
        Matchers.containsString("\n\t\u20ac save")
    );
    item.put(
        attr,
        new AttributeValueUpdate().withValue(
            new AttributeValue("this is another value")
        )
    );
    MatcherAssert.assertThat(
        item.get(attr).getS(),
        Matchers.containsString("another value")
    );
    MatcherAssert.assertThat(
        item.get(nattr).getN(),
        Matchers.endsWith("50")
    );
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:42,代码来源:MkRegionTest.java


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