On Fri, 15 Mar 2002 17:07, Stephen McConnell wrote: > How do people feel about the addition of a method to the > Configuration interface as per the following: > > /** > * Return an array of child components matching the supplied > * child name and attribute key. Returned child components shall be > * selected based on the child name and attribute key value. The > * child elements shall be unique with respect to the attribute > * value of the supplied key. This method allows the selection of > * the set of children exposing unique values for the declared > * attribute. > * > * @param name the name of the child nodes > * @param key an attribute name that must exist on a child. > */ > public Configuration[] getChildren( String name, String key ); > > Potential usage would as follows: > > Configuration[] children = m_config.getChildren("block","class"); > > The above operation would return only those children with the name > "block" and unique values for the attribute named "class". Where > multiple children exist with the same attribute key value, only the > first occurrence would be supplied.
I would prefer this and any other "search" style methods be put in a utility class instead. For one it does not break backwards compatability but I also think that it is the proper place to do it. So you could do something like ConfigUtil.getChildren( config, name, attribute ); or ConfigUtil.getChildren( config, myXPathQuery ); or ConfigUtil.getChildren( config, criteria, scope ); or whatever search strategy you want and you wont have to clutter up the main interface. -- Cheers, Pete "abandon all hope , ye who enter here" - dante, inferno -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>