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


Java VPackSlice类代码示例

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


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


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