You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsoftware.com> on 2004/08/26 21:17:29 UTC

[lang] Interpolation

Hello,

I'm just taking a quick look at Interpolation.

(1) Does it belong?

I was at first a little surprised to see something so script-like in
[lang]. I guess it does not feel like something that is missing in
java.lang. OTOH, we are just talking about another form of String search
and replace, so it does make sense under that umbrella.

(2) The name Interpolation and interpolate.

I must say that I am a bit turned off by these somewhat mathematical
names. This class is more of String "matcher" or "replacer" thingy. What
does Ant call these things? 

Interpolation.interpolate( templateString, valuesMap );

(3) Usage.

I'd like that class to be more flexible in order to do the following for
example:

Interpolation interpolation = new Interpolation();
interpolation.setStartMarker("<");
interpolation.setEndMarker(">");
interpolation.setMap(aMap);
String news = interpolation.interpolate(templateString);

Cheers,
Gary

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] Interpolation

Posted by David Graham <gr...@yahoo.com>.
Interpolation is well understood by Perl programmers.  It's probably a
good idea to use a term that many other people already know.  Of course,
if it doesn't really do interpolation in the Perl sense of the word an
alternate name would be a good idea to prevent confusion.

David

--- Gary Gregory <gg...@seagullsoftware.com> wrote:

> Hello,
> 
> I'm just taking a quick look at Interpolation.
> 
> (1) Does it belong?
> 
> I was at first a little surprised to see something so script-like in
> [lang]. I guess it does not feel like something that is missing in
> java.lang. OTOH, we are just talking about another form of String search
> and replace, so it does make sense under that umbrella.
> 
> (2) The name Interpolation and interpolate.
> 
> I must say that I am a bit turned off by these somewhat mathematical
> names. This class is more of String "matcher" or "replacer" thingy. What
> does Ant call these things? 
> 
> Interpolation.interpolate( templateString, valuesMap );
> 
> (3) Usage.
> 
> I'd like that class to be more flexible in order to do the following for
> example:
> 
> Interpolation interpolation = new Interpolation();
> interpolation.setStartMarker("<");
> interpolation.setEndMarker(">");
> interpolation.setMap(aMap);
> String news = interpolation.interpolate(templateString);
> 
> Cheers,
> Gary
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 



		
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo 

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [lang] Interpolation

Posted by Henri Yandell <ba...@generationjava.com>.

On Thu, 26 Aug 2004, Gary Gregory wrote:

> Hello,
>
> I'm just taking a quick look at Interpolation.
>
> (1) Does it belong?
>
> I was at first a little surprised to see something so script-like in
> [lang]. I guess it does not feel like something that is missing in
> java.lang. OTOH, we are just talking about another form of String search
> and replace, so it does make sense under that umbrella.

Used to be a class in Util, but we didn't want it in Lang. Someone posted
a patch for a similar thing for StringUtils and so I merged it in with the
Util one and added it into Lang awaiting opinion.

It's a pretty basic and common thing I think.

> (2) The name Interpolation and interpolate.
>
> I must say that I am a bit turned off by these somewhat mathematical
> names. This class is more of String "matcher" or "replacer" thingy. What
> does Ant call these things?
>
> Interpolation.interpolate( templateString, valuesMap );

Perl/unix-y script calls it interpolating I think. That's why I've used
that term :)

> (3) Usage.
>
> I'd like that class to be more flexible in order to do the following for
> example:
>
> Interpolation interpolation = new Interpolation();
> interpolation.setStartMarker("<");
> interpolation.setEndMarker(">");
> interpolation.setMap(aMap);
> String news = interpolation.interpolate(templateString);

Sounds interesting.  ${..} seems a common default though.

Hen


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org