avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/i18n ResourceManager.java
Date Wed, 12 Dec 2001 12:30:27 GMT
colus       01/12/12 04:30:27

  Modified:    src/java/org/apache/avalon/excalibur/i18n
                        ResourceManager.java
  Log:
  Refactor for prepare to use with Locale.
  Fixed javadoc.
  
  Revision  Changes    Path
  1.10      +39 -14    jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/i18n/ResourceManager.java
  
  Index: ResourceManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/i18n/ResourceManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ResourceManager.java	2001/12/11 09:53:28	1.9
  +++ ResourceManager.java	2001/12/12 12:30:26	1.10
  @@ -40,7 +40,7 @@
   
       /**
        * Retrieve resource for specified name.
  -     * The baseName is determined by name postfixed with ".Resources".
  +     * The basename is determined by name postfixed with ".Resources".
        *
        * @param clazz the Class
        * @return the Resources
  @@ -52,7 +52,7 @@
   
       /**
        * Retrieve resource for specified Classes package.
  -     * The baseName is determined by name of classes package 
  +     * The basename is determined by name of classes package 
        * postfixed with ".Resources".
        *
        * @param clazz the Class
  @@ -60,41 +60,66 @@
        */
       public final static Resources getPackageResources( final Class clazz )
       {
  +        return getBaseResources( getPackageResourcesBaseName( clazz ) );
  +    }
  +
  +    /**
  +     * Retrieve resource for specified Class.
  +     * The basename is determined by name of Class 
  +     * postfixed with "Resources".
  +     *
  +     * @param clazz the Class
  +     * @return the Resources
  +     */
  +    public final static Resources getClassResources( final Class clazz )
  +    {
  +        return getBaseResources( getClassResourcesBaseName( clazz ) );
  +    }
  +
  +    /**
  +     * Retrieve resource basename for specified Classes package.
  +     * The basename is determined by name of classes package 
  +     * postfixed with ".Resources".
  +     *
  +     * @param clazz the Class
  +     * @return the resource basename
  +     */
  +    public final static String getPackageResourcesBaseName( final Class clazz )
  +    {
           final Package pkg = clazz.getPackage();
   
  -        String resource;
  +        String baseName;
           if ( null == pkg )
           {
               final String name = clazz.getName();
               if ( -1 == name.lastIndexOf( "." ) )
               {
  -                resource = "Resources";
  +                baseName = "Resources";
               }
               else
               {
  -                resource = name.substring( 0, name.lastIndexOf( "." ) ) + ".Resources";
  +                baseName = name.substring( 0, name.lastIndexOf( "." ) ) + ".Resources";
               }
           }
           else
           {
  -            resource = pkg.getName() + ".Resources";
  +            baseName = pkg.getName() + ".Resources";
           }
   
  -        return getBaseResources( resource );
  +        return baseName;
       }
   
       /**
  -     * Retrieve resource for specified Class.
  -     * The baseName is determined by name of Class 
  -     * postfixed with ".Resources".
  +     * Retrieve resource basename for specified Class.
  +     * The basename is determined by name of Class 
  +     * postfixed with "Resources".
        *
        * @param clazz the Class
  -     * @return the Resources
  +     * @return the resource basename
        */
  -    public final static Resources getClassResources( final Class clazz )
  +    public final static String getClassResourcesBaseName( final Class clazz )
       {
  -        final String resource = clazz.getName() + "Resources";
  -        return getBaseResources( resource );
  +        return clazz.getName() + "Resources";
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message