Browsing projects by Tag(s)

Select a tag to browse associated projects and drill deeper into the tag cloud.

Showing page 1 of 1

Pxbioc是一个类似于google-guice的ioc容器 优势自身低耦合 使用一个内部ioc容器构造自己(MiniContainer). 高效 使用动态生成字节码方式替代java reflection api.比guice快,spring更别提了 轻量级 包大小0.0.2版新功能maven2 管理 增加了lifeCycle机制 ... [More] 完善了MiniContainer,使其可以脱离pxbioc而在其他应用作为迷你容器使用 添加一定的lazy机制(见DefaultFactoryBuilder.java) 基本使用方法//构造内部容器 MiniContainer miniContainer=new DefaultMiniContainer(); miniContainer.setConfigFile(propertiesFile path); //初始化 miniContainer.init(); FactoryManager factoryManager=miniContainer.inject(FactoryManager.class); // use factoryManager to add some factory //factoryManager.addFactory(.....); ContentManager contentManager=miniContainer.inject(CotentManager.class); // use contentManager to some value //contentManager.add("ioc","pxb"); //构造对外容器 Container container=miniContainer.inject(Container.class); //清理不用的数据 miniContainer.clear(); Man man=container.inject(Man.class); man.say(); //销毁 miniContainer.destroy(); [Less]

0
 
  0 reviews  |  0 users  |  0 current contributors  |  Analyzed about 2 years ago
 
 

Fast Reflectionjava refleciton api 可以让程序变得灵活,但是速度影响很大,fast Refleciton 可以解决这个问题 速度Fast Reflction 在我的测试中所花的时间大约是javaReflection所花时间的10%-20% 用法public static void main(String args[]) { try { int N ... [More] = 100000000; FastReflect fr = new FastReflect(); Method m = TestClass.class.getMethod("setAaa", new Class[] { int.class }); FastMethod fm = fr.getFastMethod(m); TestClass test = new TestClass(); long start = System.currentTimeMillis(); for (int i = 0; i < N; i++) { m.invoke(test, 1); } long reflectTime = System.currentTimeMillis() - start; start = System.currentTimeMillis(); for (int i = 0; i < N; i++) { fm.invoke(test, 1); } long fastReflectTime = System.currentTimeMillis() - start; System.out.println("Reflect:" + reflectTime); System.out.println("fastReflect:" + fastReflectTime); } catch (Exception e) { e.printStackTrace(); } } public static class TestClass { private int aaa; /** * @return the aaa */ public int getAaa() { return aaa; } /** * @param aaa * the aaa to set */ public void setAaa(int aaa) { this.aaa = aaa; } } [Less]

0
 
  0 reviews  |  0 users  |  0 current contributors
 
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.