Grails bean factory + method with parameters

  1.  
  2. class MyObjectFactory {
  3. static final int TYPE_ONE = 1
  4. static final int TYPE_TWO = 2
  5.  
  6. def produce(int type){
  7. if (type == TYPE_ONE){
  8. return ... // type one
  9. }
  10.  
  11. if (type == TYPE_TWO){
  12. return ... // type two
  13. }
  14.  
  15. }
  16. }
  17.  
  18. ...
  19.  
  20. beans {
  21.  
  22. myObjectFactoryBean(MyObjectFactory)
  23.  
  24. myObjectBean(myObjectFactoryBean:'produce'){bean->
  25. bean.constructorArgs = [MyObjectFactory.TYPE_ONE ]
  26. }
  27. }
  28.  

No Comments yet

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress with GimpStyle Theme design by Horacio Bella.
Entries and comments feeds. Valid XHTML and CSS.