Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 69714 invoked from network); 2 Aug 2005 18:50:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2005 18:50:24 -0000 Received: (qmail 45852 invoked by uid 500); 2 Aug 2005 18:50:19 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 45784 invoked by uid 500); 2 Aug 2005 18:50:19 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 45769 invoked by uid 99); 2 Aug 2005 18:50:19 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Aug 2005 11:50:19 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of tomatlinux@gmx.at designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 02 Aug 2005 11:50:10 -0700 Received: (qmail invoked by alias); 02 Aug 2005 18:50:17 -0000 Received: from mail.bestsolution.at (EHLO [192.168.100.150]) [83.64.113.2] by mail.gmx.net (mp032) with SMTP; 02 Aug 2005 20:50:17 +0200 X-Authenticated: #6137719 Message-ID: <42EFC077.80004@gmx.at> Date: Tue, 02 Aug 2005 20:50:31 +0200 From: Tom Schindl User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) X-Accept-Language: en-us, en MIME-Version: 1.0 To: commons-dev@jakarta.apache.org Subject: Questions concerning VariableFormatter Content-Type: multipart/mixed; boundary="------------050908000101040504010806" X-Y-GMX-Trusted: 0 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------050908000101040504010806 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I just found out that this project has exactly what I was searching for long time because MessageFormat doesn't really suite my needs. I see that this Class has been added in 2.2: -------------------------------------------- a. Is there any plan when 2.2 is released b. What would be with adding formats applied to values like MessageFormat does it {myDate,date,short}. The attached patch does that simply using MessageFormat. c. Are there any planned changes to VariableFormatter to make it more look like MessageFormat? Thanks Tom --------------050908000101040504010806 Content-Type: text/plain; name="patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.txt" Index: E:/eclipse-workspaces/beso-internal-devel/jakarta-lang/src/java/org/apache/commons/lang/text/VariableFormatter.java =================================================================== --- E:/eclipse-workspaces/beso-internal-devel/jakarta-lang/src/java/org/apache/commons/lang/text/VariableFormatter.java (revision 226795) +++ E:/eclipse-workspaces/beso-internal-devel/jakarta-lang/src/java/org/apache/commons/lang/text/VariableFormatter.java (working copy) @@ -16,6 +16,7 @@ package org.apache.commons.lang.text; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -139,7 +140,14 @@ if (this.getMap() == null) { return null; } - return this.getMap().get(varName); + + int index; + + if( (index = varName.indexOf(",")) != -1 ) { + return MessageFormat.format("{0"+varName.substring(index)+"}",new Object[] { this.getMap().get(varName.substring(0,index)) } ); + } else { + return this.getMap().get(varName); + } } /** --------------050908000101040504010806 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org --------------050908000101040504010806--