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


Java Table类代码示例

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


Table类属于com.jcabi.dynamo包,在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: retriesDelete

import com.jcabi.dynamo.Table; //导入依赖的package包/类
/**
 * ReTable can retry delete calls to method delete.
 * @throws Exception If some problem inside
 */
@Test
public void retriesDelete() throws Exception {
    final Table table = Mockito.mock(Table.class);
    final Attributes attrs = new Attributes();
    final String msg = "Exception!";
    Mockito.doThrow(new IOException(msg)).when(table)
        .delete(attrs);
    final Table retry = new ReTable(table);
    try {
        retry.delete(attrs);
    } catch (final IOException ex) {
        MatcherAssert.assertThat(ex.getMessage(), Matchers.equalTo(msg));
    }
    Mockito.verify(table, Mockito.times(Tv.THREE)).delete(attrs);
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:20,代码来源:ReTableTest.java

示例4: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
@Override
public Table table(final String name) {
    try {
        return Dynamo.live().table(name);
    } catch (final IOException ex) {
        throw new IllegalStateException(ex);
    }
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:9,代码来源:Dynamo.java

示例5: 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

示例6: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
@Override
public Table table(final String name) {
    return this.region.table(name);
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:5,代码来源:Dynamo.java

示例7: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
@Override
public Table table() {
    return new MkTable(this.data, this.tbl);
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:5,代码来源:MkFrame.java

示例8: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
@Override
public Table table(final String name) {
    return new MkTable(this.data, name);
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:5,代码来源:MkRegion.java

示例9: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
@Override
@RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
public Table table(final String name) {
    return new ReTable(this.origin.table(name));
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:6,代码来源:ReRegion.java

示例10: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
@Override
@RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
public Table table() {
    return new ReTable(this.origin.table());
}
 
开发者ID:jcabi,项目名称:jcabi-dynamo,代码行数:6,代码来源:ReFrame.java

示例11: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
/**
 * Table to work with.
 * @return Table
 */
private Table table() {
    return this.region.table("targets");
}
 
开发者ID:yegor256,项目名称:rehttp,代码行数:8,代码来源:DyStatus.java

示例12: table

import com.jcabi.dynamo.Table; //导入依赖的package包/类
/**
 * Table to work with.
 * @return Table
 */
private Table table() {
    return this.region.table("scripts");
}
 
开发者ID:yegor256,项目名称:threecopies,代码行数:8,代码来源:DyBase.java

示例13: Sigmas

import com.jcabi.dynamo.Table; //导入依赖的package包/类
/**
 * Ctor.
 * @param tbl Table
 */
Sigmas(final Table tbl) {
    this.table = tbl;
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:8,代码来源:Sigmas.java

示例14: Mistakes

import com.jcabi.dynamo.Table; //导入依赖的package包/类
/**
 * Ctor.
 * @param tbl Table
 */
Mistakes(final Table tbl) {
    this.table = tbl;
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:8,代码来源:Mistakes.java

示例15: Results

import com.jcabi.dynamo.Table; //导入依赖的package包/类
/**
 * Ctor.
 * @param tbl Table
 */
Results(final Table tbl) {
    this.table = tbl;
}
 
开发者ID:yegor256,项目名称:jpeek,代码行数:8,代码来源:Results.java


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