Hi,

I suspected that the whole thing gets a bit out of scope for [lang] and now Stephen confirmed it.

But okay, I can live with that. Just provide basic support in [lang] and I will build around it what I need. However it would be helpful if you supported a more abstract concept for the source of variable values than a simple map. If we had something like

StrBuilder.replace(String prefix, String suffix, VariableResolver v)

where VariableResolver is a very simple interface:

public interface VariableResolver
{
        Object getVariable(String name);
}

and there can be a default implementation for a MapVariableResolver. Then I could pack the logic I had before in my Interpolation class (support for different variable resolvers, default variable resolver etc.) into a special implementation of this interface.

Would this still be out of [lang]'s scope?

Oliver

Gary Gregory wrote:
Hello:

Should such proposed StrBuilder methods also not be in StringUtils?
Whichever way we go (or provide both), I can still see the benefit of a
class that can be instantiated and configured with "$" "{", "}" and a
map.

Gary

-----Original Message-----
From: Stephen Colebourne [mailto:[EMAIL PROTECTED] Sent: Monday, June 27, 2005 3:36 PM
To: Jakarta Commons Developers List
Subject: Re: [lang] text.Interpolation, on to 2.2

Gary Gregory wrote:

Hello Oliver:
I took a quick look at the ticket you linked to below. For this to

work

for System properties, a simple VariableResolver would do the trick I
think. Maybe a generic MapVariableResolver could also be provided and
maybe a factory methods in order to say simple things like:

Interpolator.newInterpolator(System.getProperties()).resolve("The file
is here ${java.io.tmpdir}");


I should point out that System.getProperties() returns a Properties which extends Hashtable which implements Map. So, these are not two separate use cases.

Thus an API of the form might be enough:
  StrBuilder.replace(prefix, suffix, map)
  StrBuilder.replaceAll(prefix, suffix, map)

Stephen


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to