CVS: Tapestry/framework/src/net/sf/tapestry/util ResourceBundlePropertySource.java,NONE,1.1.2.1

Howard Lewis Ship <[email protected]>
Newsgroups gmane.comp.java.tapestry.cvs
Message-ID <[email protected]>
Update of /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/util
In directory sc8-pr-cvs1:/tmp/cvs-serv2336/framework/src/net/sf/tapestry/util

Added Files:
      Tag: hship-2-3
	ResourceBundlePropertySource.java 
Log Message:
Add support for <listener-binding>.
Use a ResourceBundle for "factory default" configuration properties.

--- NEW FILE: ResourceBundlePropertySource.java ---
package net.sf.tapestry.util;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

import net.sf.tapestry.IPropertySource;

/**
 *  A property source that is based on a {@link java.util.ResourceBundle}.
 *
 *  @author Howard Lewis Ship
 *  @version $Id: ResourceBundlePropertySource.java,v 1.1.2.1 2003/01/04 02:46:50 hship Exp $
 *  @since 2.4
 *
 **/

public class ResourceBundlePropertySource implements IPropertySource
{
    private ResourceBundle _bundle;

    public ResourceBundlePropertySource(ResourceBundle bundle)
    {
        _bundle = bundle;
    }

    /**
     *  Gets the value from the bundle by invoking
     *  {@link ResourceBundle#getString(java.lang.String)}.  If
     *  the bundle does not contain the key (that is, it it
     *  throws {@link java.util.MissingResourceException}), then
     *  null is returned.
     * 
     **/
    
    public String getPropertyValue(String propertyName)
    {
        try
        {
            return _bundle.getString(propertyName);
        }
        catch (MissingResourceException ex)
        {
            return null;
        }
    }

}



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.