# HG changeset patch # User Sascha L. Teichmann # Date 1379684541 -7200 # Node ID beb9e94f04d3a8aa3bdd5d146e24ce4a4c31d7fa # Parent 4e597d4353987a102e7f0bf84d0c6d7d88a09b5d Allow comma separated names in "names" attribute in out generators to allow registering for more than one name. Old "name" attribute is removed. diff -r 4e597d435398 -r beb9e94f04d3 artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java Fri Sep 20 15:29:02 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/context/RiverContextFactory.java Fri Sep 20 15:42:21 2013 +0200 @@ -332,23 +332,31 @@ for (int i = 0; i < num; i++) { Element item = (Element)outGenerators.item(i); - String name = item.getAttribute("name"); + String name = item.getAttribute("names"); String clazz = item.getAttribute("class"); if (name.isEmpty() || clazz.isEmpty()) { continue; } + Class generatorClass = null; + try { - generators.put( - name, - new Pair, Element>( - (Class)Class.forName(clazz), item)); - - idx++; + generatorClass = (Class)Class.forName(clazz); } catch (ClassNotFoundException cnfe) { logger.warn(cnfe, cnfe); + continue; + } + + Pair, Element> pair = + new Pair, Element>(generatorClass, item); + + for (String key: name.split("[\\s,]")) { + if (!(key = key.trim()).isEmpty()) { + generators.put(key, pair); + idx++; + } } }