论坛首页 Java企业应用论坛

Yan Container beta 1 发布

浏览 36118 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2005-04-16  
Beta 1.3 released.

One important new combinator is: factory()

Makes injecting abstract factory much easier. Don't even need an anonymous class.

public interface ProductFactory{
  Product createProduct(int i);;
}

public interface Product{
}
public class UseFactory{
  private final ProductFactory factory;
  public UseFactory(ProductFactory f);{
    this.factory = f;
  }
}
public class Product1 implements Product{
  public Product1(int i);{...}
}
public class Product2 implements Product{
  public static Product  instance(int i);{...}
}

Normally, for creating UseFactory object, two different factory classes need to be created for Product1 and Product2.

At least you need anonymous class such as:

new UseFactory(new ProductFactory();{
  public Product createProduct(int i);{
    return new Product1(i);;
  }
});;


new UseFactory(new ProductFactory();{
  public Product createProduct(int i);{
    return Product2.instance(i);;
  }
});;


With Yan, things are easier.

Component product1 = Components.ctor(Product1.class);;
Component product2 = Components.static_method(Product2.class, "instance");;
Component factory1 = product1.factory(ProductFactory.class);;
Component factory2 = product2.factory(ProductFactory.class);;


The factories are created for free. No need to create trivial factory classes. Therefore, substantially reduces coupling between factory classes and product classes.
0 请登录后投票
   发表时间:2005-04-21  
Yan is formally moved out of jfun project.

The cvs is now under:

cvs -d:pserver:anonymous@cvs-pserver.sf.net:443/cvsroot/yan co yan
0 请登录后投票
   发表时间:2005-05-07  
新来乍到。不过关注了些时间了。
我也模仿spring写了个简易的ioc,加上些自己想要的功能。现在想加入对aop的支持,大家有asm/bcel/cglib/aspectwerkz...这些东西的使用经验能分享吗,觉得哪个用起来更容易更强?
佩服ajoo。
0 请登录后投票
   发表时间:2005-06-05  
ajoo太没有人性了
0 请登录后投票
   发表时间:2005-06-05  
CVS上不去唉
0 请登录后投票
   发表时间:2005-06-07  
嗯?
可以下载的呀:

www.sourceforge.net/projects/yan


cvs为啥上不去?你在防火墙后头?
0 请登录后投票
   发表时间:2005-06-27  
haha, 现在好了
0 请登录后投票
   发表时间:2006-11-23  
A micro IOC (Inversion of Control) container that is absolutely non-intrusive to components and with no restriction on injection method. (be it constructor-based, java bean setter based, static method based, etc).

搜索JMX居然摸到了这里,前后大概看了一下,也看了Version 0.2,建议ajoo将大行其道的Spring里不具备的功能,从Yan里分离贡献过去,这样更可以骄傲了一把,实在点儿:)
0 请登录后投票
论坛首页 Java企业应用版

跳转论坛:
Global site tag (gtag.js) - Google Analytics