• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Selma类的典型用法和代码示例

java 1次浏览

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

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

示例1: builder

点赞 3

import fr.xebia.extras.selma.Selma; //导入依赖的package包/类
@Override
public <SOURCE, DESTINATION> ReflectionModelTransformerBuilder<SOURCE, DESTINATION> builder() {
	return sourceType -> destinationType -> excludeFieldNames -> () -> {

		Class<SelmaModelTransformer<SOURCE, DESTINATION>> selmaModelTransformerType = selmaModelTransformersBag.get(sourceType, destinationType);
		assertRegistered(selmaModelTransformerType, sourceType, destinationType);
		// XXX can't assert exclusions as @Mapper annotation is not retained for runtime :O(
		//assertExclusions(excludeFieldNames, selmaModelTransformerType.getAnnotation(Mapper.class).withIgnoreFields());

		SelmaModelTransformer<SOURCE, DESTINATION> selmaModelTransformer = Selma.getMapper(selmaModelTransformerType);
		return source -> destination -> {
			return selmaModelTransformer.transform(source, destination);
		};

	};
}
 

开发者ID:InterstellarOcean,
项目名称:terraforming,
代码行数:17,
代码来源:TestSelmaModelTransformerProvider.java

示例2: testSelmaMapperNullAuthor

点赞 3

import fr.xebia.extras.selma.Selma; //导入依赖的package包/类
@Test
public void testSelmaMapperNullAuthor() throws Exception {
	SelmaBlogEntryMapper mapper = Selma.builder(SelmaBlogEntryMapper.class).build();
	Assert.assertNull(mapper.toJpaBlogEntry(null));
	Assert.assertNull(mapper.toResourceBlogEntry(null));

	BlogEntry be = newBlogEntry();
	be.setAuthor(null);

	BlogEntryResource result = mapper.toResourceBlogEntry(be);
	Assert.assertNotNull(result);

	Assert.assertEquals("title goes here", result.getTitle());
	Assert.assertNull(result.getAuthorName());
	Assert.assertNull(result.getAuthorSignature());
	Assert.assertEquals(1, result.getId().intValue());

	Assert.assertNotNull(result.getProperties());
	Assert.assertTrue(result.getProperties().isCommentsEnabled());
	Assert.assertTrue(result.getProperties().isEnabled());
}
 

开发者ID:aracrown,
项目名称:ara-blog-examples,
代码行数:22,
代码来源:SelmaBlogEntryMapperTest.java

示例3: testSelmaMapper

点赞 2

import fr.xebia.extras.selma.Selma; //导入依赖的package包/类
@Test
public void testSelmaMapper() throws Exception {
	SelmaBlogEntryMapper mapper = Selma.builder(SelmaBlogEntryMapper.class).build();

	BlogEntryResource result = mapper.toResourceBlogEntry(newBlogEntry());

	Assert.assertEquals("title goes here", result.getTitle());
	Assert.assertEquals("name", result.getAuthorName());
	Assert.assertEquals("signature", result.getAuthorSignature());
	Assert.assertEquals(1, result.getId().intValue());

	Assert.assertNotNull(result.getProperties());
	Assert.assertTrue(result.getProperties().isCommentsEnabled());
	Assert.assertTrue(result.getProperties().isEnabled());

	BlogEntry reverse = mapper.toJpaBlogEntry(result);

	Assert.assertEquals("title goes here", reverse.getTitle());
	Assert.assertEquals(1, reverse.getId().intValue());
	Assert.assertTrue(reverse.isCommentsEnabled());
	Assert.assertTrue(reverse.isEnabled());

	Assert.assertNotNull(reverse.getAuthor());
	Assert.assertEquals("name", reverse.getAuthor().getName());
	Assert.assertEquals("signature", reverse.getAuthor().getSignature());

}
 

开发者ID:aracrown,
项目名称:ara-blog-examples,
代码行数:28,
代码来源:SelmaBlogEntryMapperTest.java

示例4: testSelmaMapperNullAuthorName

点赞 2

import fr.xebia.extras.selma.Selma; //导入依赖的package包/类
@Test
public void testSelmaMapperNullAuthorName() throws Exception {
	SelmaBlogEntryMapper mapper = Selma.builder(SelmaBlogEntryMapper.class).build();

	BlogEntry be = newBlogEntry();
	be.getAuthor().setName(null);
	BlogEntryResource result = mapper.toResourceBlogEntry(be);

	Assert.assertEquals("title goes here", result.getTitle());
	Assert.assertNull(result.getAuthorName());
	Assert.assertEquals("signature", result.getAuthorSignature());
	Assert.assertEquals(1, result.getId().intValue());

	Assert.assertNotNull(result.getProperties());
	Assert.assertTrue(result.getProperties().isCommentsEnabled());
	Assert.assertTrue(result.getProperties().isEnabled());

	BlogEntry reverse = mapper.toJpaBlogEntry(result);

	Assert.assertEquals("title goes here", reverse.getTitle());
	Assert.assertEquals(1, reverse.getId().intValue());
	Assert.assertTrue(reverse.isCommentsEnabled());
	Assert.assertTrue(reverse.isEnabled());

	Assert.assertNotNull(reverse.getAuthor());
	Assert.assertNull(reverse.getAuthor().getName());
	Assert.assertEquals("signature", reverse.getAuthor().getSignature());
}
 

开发者ID:aracrown,
项目名称:ara-blog-examples,
代码行数:29,
代码来源:SelmaBlogEntryMapperTest.java

示例5: provides

点赞 2

import fr.xebia.extras.selma.Selma; //导入依赖的package包/类
@Override
public boolean provides(Class<?> library) {
	return fr.xebia.extras.selma.Selma.class.equals(library);
}
 

开发者ID:InterstellarOcean,
项目名称:terraforming,
代码行数:5,
代码来源:TestSelmaModelTransformerProvider.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)