If you just want output formatting (and not input parsing), it can be as simple as this:

public StringBuffer format(Object object, StringBuffer stringBuffer, FieldPosition fieldPosition)
    {
        if (object instanceof Number)
        {
stringBuffer.append(((Number)object).intValue() == 2 ? "Y" : "");
        }

        return stringBuffer;
    }



    /**
     * @throw RuntimeException parseObject is not implemented
     */
    public Object parseObject(String arg0, ParsePosition arg1)
    {
        throw new RuntimeException("parseObject is not implemented");
    }


This is an output formatter that takes a number formats this to "Y" if the value is 2 and to an empty string for all other values. Don't ask, legacy data.

Chuck




On Mar 29, 2007, at 4:58 PM, Kevin Windham wrote:

I am looking for info on how to create a formatter for phone numbers. I have surmised that I am supposed to use java.text.format in some fashion, but I am having trouble finding any examples.

Does anyone have any examples they can share, or can point me to some better info than the java docs on the class.

Thanks,
Kevin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/chill% 40global-village.net

This email sent to [EMAIL PROTECTED]


--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects





_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to