You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/08/06 18:33:17 UTC

DO NOT REPLY [Bug 35588] - [lang] New interpolation features

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35588>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35588


oliver.heger@t-online.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #15662|0                           |1
        is obsolete|                            |




------- Additional Comments From oliver.heger@t-online.de  2005-08-06 18:33 -------
Created an attachment (id=15933)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=15933&action=view)
New implementation of VariableFormatter

This patch contains some modifications of VariableFormatter with the purpose to
make the code easier to understand and more integrated into the rest of the
text package.

The main idea of this patch is to separate the logic for detecting variables
from the processing of variables. There is now a new nested class
VariableParser, which scans the input data for text and variable tokens. This
class is used in the main interpolation method and called in a loop to obtain
all tokens and process them according to their type.

This approach IMO makes customization of this class easier. ATM the involved
helper classes and methods are protected allowing a sub class to override some
of them. This way e.g. completely different mechanisms for detecting variables
or escaping could be implemented. If you think that the API becomes too
complex, the involved classes and methods could be made private.

There are the following further modifications and improvements:

- The main interpolation method now operates on a char[] and can therefor
easier be used from other classes in this package.

- StrTokenizer.Matcher is used for detecting variable tokens. This is a
"natural" way of dealing with char[].

- The escaping mechanism can now be implemented much easier. No need for
escape() and unescape() methods or for escaping variable end tokens.

- StrBuilder is used internally for constructing result strings instead of
StringBuffer.

WDYT?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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