[jboss-dev-forums] [Design the new POJO MicroContainer] - Demand / Supply string transformation

alesj do-not-reply at jboss.com
Fri Oct 26 05:52:37 EDT 2007


Talking yesterday at Zurich JUG, describing our IoC, when mentioning Demand/Supply, Bela got an idea of extending that notion with a regexp.

Thinking about it, we could have a generic 'transfromer' attribute on the demand/supply element.

e.g.

  | <demand transformer="org.jboss.ioc.transformer.RegExp">^[A-Z0-9._%+-]+ at jboss\.((org)|(com))$</demand>
  | 
  | <supply>mc at jboss.org</supply>
  | 
  | <demand transformer="org.jboss.ioc.transformer.IntLimit">(0,255]</demand>
  | 
  | <supply transformer="org.jboss.util.propertyeditor.IntegerEditor">128</supply>
  | 

Where a demand transformer would create Matcheable, supply transformer would simple be a PropertyEditor.

e.g.

  | public interface Matcheable
  | {
  |    boolean match(Object other);
  | }
  | 
  | for(Map.Entry entry : suppliers.keySet())
  | {
  |    if (name instance of Matcheable)
  |    { 
  |        Matcheable matcheable = (Matcheable)name;
  |        if (matcheable.match(entry.getKey()))
  |           List<KernelControllerContext> list = entry.getValue();            
  |            if (list != null && list.isEmpty() == false)
  |               return list.get(0);
  |    }   
  |    
  |    ...
  | }
  | 




View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099181#4099181

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099181



More information about the jboss-dev-forums mailing list