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._%+-]+(a)jboss\.((org)|(com))$</demand>
|
| <supply>mc(a)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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...