• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VPackSlice类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



VPackSlice类属于com.arangodb.velocypack包,在下文中一共展示了VPackSlice类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fromBoolean

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromBoolean() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityBoolean()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice a = vpack.get("a");
		assertThat(a.isBoolean(), is(true));
		assertThat(a.getAsBoolean(), is(true));
	}
	{
		final VPackSlice b = vpack.get("b");
		assertThat(b.isBoolean(), is(true));
		assertThat(b.getAsBoolean(), is(false));
	}
	{
		final VPackSlice c = vpack.get("c");
		assertThat(c.isBoolean(), is(true));
		assertThat(c.getAsBoolean(), is(true));
	}
	{
		final VPackSlice d = vpack.get("d");
		assertThat(d.isBoolean(), is(true));
		assertThat(d.getAsBoolean(), is(false));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:27,代码来源:VPackSerializeDeserializeTest.java


示例2: toBoolean

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void toBoolean() throws IOException {
	final VPackBuilder builder = new VPackBuilder();
	{
		builder.add(ValueType.OBJECT);
		builder.add("a", false);
		builder.add("b", true);
		builder.add("c", Boolean.FALSE);
		builder.add("d", Boolean.TRUE);
		builder.close();
	}
	final VPackSlice vpack = builder.slice();
	final TestEntityBoolean entity = mapper.readValue(vpack.getBuffer(), TestEntityBoolean.class);
	assertThat(entity, is(notNullValue()));
	assertThat(entity.a, is(false));
	assertThat(entity.b, is(true));
	assertThat(entity.c, is(Boolean.FALSE));
	assertThat(entity.d, is(Boolean.TRUE));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:20,代码来源:VPackSerializeDeserializeTest.java


示例3: fromStrings

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromStrings() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityString()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice s = vpack.get("s");
		assertThat(s.isString(), is(true));
		assertThat(s.getAsString(), is("test"));
	}
	{
		final VPackSlice c1 = vpack.get("c1");
		assertThat(c1.isString(), is(true));
		assertThat(c1.getAsChar(), is('t'));
	}
	{
		final VPackSlice c2 = vpack.get("c2");
		assertThat(c2.isString(), is(true));
		assertThat(c2.getAsChar(), is('t'));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:22,代码来源:VPackSerializeDeserializeTest.java


示例4: toStrings

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void toStrings() throws IOException {
	final VPackBuilder builder = new VPackBuilder();
	{
		builder.add(ValueType.OBJECT);
		builder.add("s", "abc");
		builder.add("c1", 'd');
		builder.add("c2", 'd');
		builder.close();
	}
	final VPackSlice vpack = builder.slice();
	final TestEntityString entity = mapper.readValue(vpack.getBuffer(), TestEntityString.class);
	assertThat(entity, is(notNullValue()));
	assertThat(entity.s, is("abc"));
	assertThat(entity.c1, is(new Character('d')));
	assertThat(entity.c1, is(new Character('d')));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:18,代码来源:VPackSerializeDeserializeTest.java


示例5: fromInteger

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromInteger() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityInteger()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice i1 = vpack.get("i1");
		assertThat(i1.isInteger(), is(true));
		assertThat(i1.getAsInt(), is(1));
	}
	{
		final VPackSlice i2 = vpack.get("i2");
		assertThat(i2.isInteger(), is(true));
		assertThat(i2.getAsInt(), is(1));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例6: fromLong

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromLong() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityLong()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice l1 = vpack.get("l1");
		assertThat(l1.isInteger(), is(true));
		assertThat(l1.getAsLong(), is(1L));
	}
	{
		final VPackSlice l2 = vpack.get("l2");
		assertThat(l2.isInteger(), is(true));
		assertThat(l2.getAsLong(), is(1L));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例7: fromFloat

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromFloat() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityFloat()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice f1 = vpack.get("f1");
		assertThat(f1.isDouble(), is(true));
		assertThat(f1.getAsFloat(), is(1.0F));
	}
	{
		final VPackSlice f2 = vpack.get("f2");
		assertThat(f2.isDouble(), is(true));
		assertThat(f2.getAsFloat(), is(1.0F));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例8: fromShort

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromShort() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityShort()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice s1 = vpack.get("s1");
		assertThat(s1.isInteger(), is(true));
		assertThat(s1.getAsShort(), is((short) 1));
	}
	{
		final VPackSlice s2 = vpack.get("s2");
		assertThat(s2.isInteger(), is(true));
		assertThat(s2.getAsShort(), is((short) 1));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例9: fromByte

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromByte() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityByte()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice b1 = vpack.get("b1");
		assertThat(b1.isInteger(), is(true));
		assertThat(b1.getAsByte(), is((byte) 1));
	}
	{
		final VPackSlice b2 = vpack.get("b2");
		assertThat(b2.isInteger(), is(true));
		assertThat(b2.getAsByte(), is((byte) 100));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例10: fromDouble

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromDouble() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityDouble()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice d1 = vpack.get("d1");
		assertThat(d1.isDouble(), is(true));
		assertThat(d1.getAsDouble(), is(1.5));
	}
	{
		final VPackSlice d2 = vpack.get("d2");
		assertThat(d2.isDouble(), is(true));
		assertThat(d2.getAsDouble(), is(1.5));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例11: fromBigNumbers

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromBigNumbers() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityBigNumber()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		final VPackSlice bi = vpack.get("bi");
		assertThat(bi.isInteger(), is(true));
		assertThat(bi.getAsBigInteger(), is(BigInteger.valueOf(1L)));
	}
	{
		final VPackSlice bd = vpack.get("bd");
		assertThat(bd.isDouble(), is(true));
		assertThat(bd.getAsBigDecimal(), is(BigDecimal.valueOf(1.5)));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:17,代码来源:VPackSerializeDeserializeTest.java


示例12: toCollectionExtendedWithNulls

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void toCollectionExtendedWithNulls() throws Exception {
	final VPackBuilder builder = new VPackBuilder();
	{
		builder.add(ValueType.OBJECT);
		{
			builder.add("a1", ValueType.ARRAY);
			builder.add("one");
			builder.add(ValueType.NULL);
			builder.add("two");
			builder.close();
		}
		builder.close();
	}

	final VPackSlice vpack = builder.slice();
	final TestEntityCollectionExtendedWithNulls entity = mapper.readValue(vpack.getBuffer(),
		TestEntityCollectionExtendedWithNulls.class);
	assertThat(entity, is(notNullValue()));
	assertThat(entity.getA1(), is(notNullValue()));
	assertThat(entity.getA1().size(), is(3));
	assertThat(entity.getA1(), contains("one", null, "two"));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:24,代码来源:VPackSerializeDeserializeTest.java


示例13: toObjectInArray

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void toObjectInArray() throws IOException {
	final VPackBuilder builder = new VPackBuilder();
	{
		builder.add(ValueType.OBJECT);
		builder.add("a1", ValueType.ARRAY);
		{
			builder.add(ValueType.OBJECT);
			builder.add("s", "abc");
			builder.close();
		}
		builder.close();
		builder.close();
	}
	final VPackSlice vpack = builder.slice();
	final TestEntityObjectInArray entity = mapper.readValue(vpack.getBuffer(), TestEntityObjectInArray.class);
	assertThat(entity, is(notNullValue()));
	assertThat(entity.a1, is(notNullValue()));
	assertThat(entity.a1.length, is(1));
	final TestEntityString st = entity.a1[0];
	assertThat(st, is(notNullValue()));
	assertThat(st.s, is("abc"));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:24,代码来源:VPackSerializeDeserializeTest.java


示例14: fromInheritance

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromInheritance() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityB()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	assertThat(vpack.getLength(), is(2));
	{
		final VPackSlice a = vpack.get("a");
		assertThat(a.isString(), is(true));
		assertThat(a.getAsString(), is("a"));
	}
	{
		final VPackSlice b = vpack.get("b");
		assertThat(b.isString(), is(true));
		assertThat(b.getAsString(), is("b"));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:18,代码来源:VPackSerializeDeserializeTest.java


示例15: toInterface

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void toInterface() throws IOException {
	final VPackBuilder builder = new VPackBuilder();
	{
		builder.add(ValueType.OBJECT);
		builder.add("d", ValueType.OBJECT);
		builder.add("d", "test");
		builder.close();
		builder.close();
	}
	final VPackSlice slice = builder.slice();
	final VPack vPack = new VPack.Builder()
			.registerInstanceCreator(TestEntityD.class, new VPackInstanceCreator<TestEntityD>() {
				@Override
				public TestEntityD createInstance() {
					return new TestEntityDImpl();
				}
			}).build();
	final TestEntityC entity = vPack.deserialize(slice, TestEntityC.class);
	assertThat(entity, is(notNullValue()));
	assertThat(entity.d, is(notNullValue()));
	assertThat(entity.d.getD(), is("test"));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:24,代码来源:VPackSerializeDeserializeTest.java


示例16: directFromCollectionWithType

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void directFromCollectionWithType() throws IOException {
	final Collection<TestEntityString> list = new ArrayList<>();
	list.add(new TestEntityString());
	list.add(new TestEntityString());

	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(list));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isArray(), is(true));
	assertThat(vpack.getLength(), is(list.size()));
	for (int i = 0; i < list.size(); i++) {
		final VPackSlice entry = vpack.get(i);
		assertThat(entry.isObject(), is(true));
		assertThat(entry.getLength(), is(3));
		final VPackSlice s = entry.get("s");
		assertThat(s.isString(), is(true));
		assertThat(s.getAsString(), is("test"));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:20,代码来源:VPackSerializeDeserializeTest.java


示例17: directFromObjectMap

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void directFromObjectMap() throws IOException {
	final Map<TestEntityString, TestEntityString> map = new HashMap<>();
	map.put(new TestEntityString(), new TestEntityString());
	map.put(new TestEntityString(), new TestEntityString());

	// final VPackSlice vpack = new VPack.Builder().build().serialize(map,
	// new SerializeOptions().type(new Type<Map<TestEntityString, TestEntityString>>() {
	// }.getType()));
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(map));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isArray(), is(true));
	assertThat(vpack.getLength(), is(map.size()));
	for (int i = 0; i < map.size(); i++) {
		final VPackSlice entry = vpack.get(i);
		final VPackSlice key = entry.get("key");
		checkStringEntity(key);
		final VPackSlice value = entry.get("value");
		checkStringEntity(value);
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:22,代码来源:VPackSerializeDeserializeTest.java


示例18: directFromMapWithinMap

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void directFromMapWithinMap() throws IOException {
	final Map<String, Object> map = new HashMap<>();
	final Map<String, Object> map2 = new HashMap<>();
	map2.put("b", "test");
	map.put("a", map2);
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(map));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	assertThat(vpack.size(), is(1));
	final VPackSlice a = vpack.get("a");
	assertThat(a.isObject(), is(true));
	assertThat(a.size(), is(1));
	final VPackSlice b = a.get("b");
	assertThat(b.isString(), is(true));
	assertThat(b.getAsString(), is("test"));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:18,代码来源:VPackSerializeDeserializeTest.java


示例19: fieldNamingStrategySerialize

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fieldNamingStrategySerialize() throws IOException {
	final ObjectMapper mapper = new VPackMapper();
	mapper.setPropertyNamingStrategy(new PropertyNamingStrategy() {
		private static final long serialVersionUID = 1L;

		@Override
		public String nameForGetterMethod(
			final MapperConfig<?> config,
			final AnnotatedMethod method,
			final String defaultName) {
			return "bla";
		}
	});
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityA()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	final VPackSlice bla = vpack.get("bla");
	assertThat(bla.isString(), is(true));
	assertThat(bla.getAsString(), is("a"));
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:22,代码来源:VPackSerializeDeserializeTest.java


示例20: fromDate

import com.arangodb.velocypack.VPackSlice; //导入依赖的package包/类
@Test
public void fromDate() throws IOException {
	final VPackSlice vpack = new VPackSlice(mapper.writeValueAsBytes(new TestEntityDate()));
	assertThat(vpack, is(notNullValue()));
	assertThat(vpack.isObject(), is(true));
	{
		assertThat(vpack.get("utilDate").isString(), is(true));
		assertThat(vpack.get("utilDate").getAsString(), is(DATE_FORMAT.format(new Date(1474988621))));
	}
	{
		assertThat(vpack.get("sqlDate").isString(), is(true));
		assertThat(vpack.get("sqlDate").getAsString(), is(DATE_FORMAT.format(new java.sql.Date(1474988621))));
	}
	{
		assertThat(vpack.get("timestamp").isString(), is(true));
		assertThat(vpack.get("timestamp").getAsString(),
			is(DATE_FORMAT.format(new java.sql.Timestamp(1474988621))));
	}
}
 
开发者ID:arangodb,项目名称:jackson-dataformat-velocypack,代码行数:20,代码来源:VPackSerializeDeserializeTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SourceRange类代码示例发布时间:2022-05-23
下一篇:
Java SNode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap