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

Java ObjectRenderer类代码示例

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

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



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

示例1: noDelegationTest

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
@Test
public void noDelegationTest() {
	JCategory context = new JCategory();
	//instantiating categories
	TypeCategory<Animal> animalCategory = context.forClass(Animal.class); //type category for Animal
	TypeCategory<HasLegs> hasLegsCategory = context.forClass(HasLegs.class); //type category for HasLegs
	TypeCategory<Cat> catCategory = context.forClass(Cat.class); //type category for Cat
	
	//setting properties
	animalCategory.setProperty(OBJECT_RENDERER_KEY, new AnimalRenderer()); //ObjectRenderer property is an instance of AnimalRenderer for Animal
	hasLegsCategory.setProperty(OBJECT_RENDERER_KEY, new HasLegsRenderer()); //ObjectRenderer property is an instance of HasLegsRenderer for HasLegs
	
	//testing
	ObjectRenderer renderer = catCategory.getStrategy(ObjectRenderer.class);
	assertEquals("animal", renderer.doRender(new Cat()));
}
 
开发者ID:jcategory,项目名称:jcategory,代码行数:17,代码来源:StrategyTutorialTest.java


示例2: delegationTest

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
@Test
public void delegationTest() {
	JCategory context = new JCategory();
	//instantiating categories
	TypeCategory<Animal> animalCategory = context.forClass(Animal.class); //type category for Animal
	TypeCategory<HasLegs> hasLegsCategory = context.forClass(HasLegs.class); //type category for HasLegs
	TypeCategory<Cat> catCategory = context.forClass(Cat.class); //type category for Cat
	
	//setting properties
	animalCategory.setProperty(OBJECT_RENDERER_KEY, new DelegationAnimalRenderer()); //ObjectRenderer property is an instance of DelegationAnimalRenderer for Animal
	hasLegsCategory.setProperty(OBJECT_RENDERER_KEY, new HasLegsRenderer()); //ObjectRenderer property is an instance of HasLegsRenderer for HasLegs
	
	//testing
	ObjectRenderer renderer = catCategory.getStrategy(ObjectRenderer.class);
	assertEquals("has-legs", renderer.doRender(new Cat()));
}
 
开发者ID:jcategory,项目名称:jcategory,代码行数:17,代码来源:StrategyTutorialTest.java


示例3: test1

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test1() {
  RendererMap map = new RendererMap();
  ObjectRenderer dr = map.getDefaultRenderer();
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, dr);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:ORTestCase.java


示例4: test2

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test2() {
  RendererMap map = new RendererMap();
  map.put(Integer.class, ior);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, ior);

}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:9,代码来源:ORTestCase.java


示例5: test3

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test3() {
  RendererMap map = new RendererMap();
  map.put(Number.class, ior);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, ior);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:ORTestCase.java


示例6: test4

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test4() {
  RendererMap map = new RendererMap();
  map.put(Object.class, oor);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, oor);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:ORTestCase.java


示例7: test5

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test5() {
  RendererMap map = new RendererMap();

  map.put(Object.class, oor);
  map.put(Number.class, nor);
  map.put(Integer.class, ior);

  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, ior);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:12,代码来源:ORTestCase.java


示例8: test6

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test6() {
  RendererMap map = new RendererMap();

  map.put(Object.class, oor);
  map.put(Number.class, nor);
 
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, nor);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:11,代码来源:ORTestCase.java


示例9: test7

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test7() throws Exception {
  RendererMap map = new RendererMap();
  Class comparable = null; 
  try {
      comparable = getClass().forName("java.lang.Comparable");
  } catch(Exception ex) {
      //  likely JDK 1.1
      return;
  }
  map.put(comparable, cor);
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, cor);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:15,代码来源:ORTestCase.java


示例10: test8

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test8() {
  RendererMap map = new RendererMap();
  map.put(Serializable.class, sor); 
  ObjectRenderer r = map.get(Integer.class);
  assertEquals(r, sor);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:ORTestCase.java


示例11: test9

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test9() {
  RendererMap map = new RendererMap();
  map.put(Y.class, yor); 
  ObjectRenderer r = map.get(B.class);
  assertEquals(r, yor);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:ORTestCase.java


示例12: test10

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void test10() {
  RendererMap map = new RendererMap();
  map.put(X.class, xor); 
  ObjectRenderer r = map.get(B.class);
  assertEquals(r, xor);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:ORTestCase.java


示例13: setRenderer

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
public
void setRenderer(Class renderedClass, ObjectRenderer renderer);
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:3,代码来源:RendererSupport.java


示例14: addRenderer

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
/**
   Add an object renderer for a specific class.
 */
public
void addRenderer(Class classToRender, ObjectRenderer or) {
  rendererMap.put(classToRender, or);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:Hierarchy.java


示例15: setRenderer

import org.apache.log4j.or.ObjectRenderer; //导入依赖的package包/类
/**
   Used by subclasses to add a renderer to the hierarchy passed as parameter.
 */
public
void setRenderer(Class renderedClass, ObjectRenderer renderer) {
  rendererMap.put(renderedClass, renderer);
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:8,代码来源:Hierarchy.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Parser类代码示例发布时间:2022-05-23
下一篇:
Java SimplexSolver类代码示例发布时间: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