portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pau...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/util MetaData.java
Date Tue, 13 Aug 2002 13:25:36 GMT
paulsp      2002/08/13 06:25:36

  Modified:    src/java/org/apache/jetspeed/util MetaData.java
  Log:
  o  Housekeeping, as directed by checkStyle.  This involved adding and removing
      space.  No functional changes where made.
  
  Revision  Changes    Path
  1.8       +118 -63   jakarta-jetspeed/src/java/org/apache/jetspeed/util/MetaData.java
  
  Index: MetaData.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/MetaData.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MetaData.java	7 Mar 2001 06:49:55 -0000	1.7
  +++ MetaData.java	13 Aug 2002 13:25:36 -0000	1.8
  @@ -67,16 +67,17 @@
   @author <a href="mailto:raphael@apache.org">RaphaŽl Luta</a>
   @version $Id$
   */
  -public class MetaData {
  +public class MetaData
  +{
   
       public static final String DEFAULT_TITLE = 
  -        JetspeedResources.getString( JetspeedResources.DEFAULT_TITLE_KEY );
  +        JetspeedResources.getString(JetspeedResources.DEFAULT_TITLE_KEY);
   
       public static final String DEFAULT_DESCRIPTION = 
  -        JetspeedResources.getString( JetspeedResources.DEFAULT_DESCRIPTION_KEY );
  +        JetspeedResources.getString(JetspeedResources.DEFAULT_DESCRIPTION_KEY);
   
       public static final String DEFAULT_IMAGE = 
  -        JetspeedResources.getString( JetspeedResources.DEFAULT_IMAGE_KEY );
  +        JetspeedResources.getString(JetspeedResources.DEFAULT_IMAGE_KEY);
   
       /**
       Hashtable to store all the properties
  @@ -86,21 +87,24 @@
       /**
       Sets a title in the default locale
       */
  -    public void setTitle( String title ) {
  -        setTitle(title,null);
  +    public void setTitle(String title)
  +    {
  +        setTitle(title, null);
       }
   
       /**
       Sets a title for the given locale
       */
  -    public void setTitle( String title, Locale locale ) {
  -        setProperty("title",locale,title);
  +    public void setTitle(String title, Locale locale)
  +    {
  +        setProperty("title", locale, title);
       }
   
       /**
       Returns the title for the default locale
       */
  -    public String getTitle() {
  +    public String getTitle()
  +    {
           return getTitle(null);
       }
   
  @@ -108,13 +112,19 @@
       Returns the title for the given locale, if the title isn't defined
       in this locale or the locale, return the default title
       */
  -    public String getTitle( Locale locale ) {
  -        String title = (String)getProperty("title",locale);
  -
  -        if ( ( title==null ) && ( locale!=null ) )
  -            title=(String)getProperty("title", null);
  -
  -        if ( title==null ) title=DEFAULT_TITLE;
  +    public String getTitle(Locale locale)
  +    {
  +        String title = (String) getProperty("title", locale);
  +
  +        if ((title == null) && (locale != null))
  +        {
  +            title = (String) getProperty("title", null);
  +        }
  +
  +        if (title == null)
  +        {
  +            title = DEFAULT_TITLE;
  +        }
   
           return title;
       }
  @@ -122,35 +132,44 @@
       /**
       Sets a descriptive image in the default locale
       */
  -    public void setImage( String image ) {
  -        setImage( image, null );
  +    public void setImage(String image)
  +    {
  +        setImage(image, null);
       }
   
       /**
       Sets a descriptive image for the given locale
       */
  -    public void setImage( String image, Locale locale ) {
  -        setProperty( "image", locale, image );
  +    public void setImage(String image, Locale locale)
  +    {
  +        setProperty("image", locale, image);
       }
   
       /**
       Returns the descriptive image for the default locale
       */
  -    public String getImage() {
  -        return getImage( null );
  +    public String getImage()
  +    {
  +        return getImage(null);
       }
   
       /**
       Returns the descriptive image for the given locale, if the image isn't defined
       in this locale or the locale, return the default image
       */
  -    public String getImage( Locale locale ) {
  -        String image = (String)getProperty( "image", locale );
  -
  -        if ( ( image == null ) && ( locale != null ) )
  -            image = (String)getProperty( "image", null );
  -
  -        if ( image == null ) image = DEFAULT_IMAGE;
  +    public String getImage(Locale locale)
  +    {
  +        String image = (String) getProperty("image", locale);
  +
  +        if ((image == null) && (locale != null))
  +        {
  +            image = (String) getProperty("image", null);
  +        }
  +
  +        if (image == null)
  +        {
  +            image = DEFAULT_IMAGE;
  +        }
   
           return image;
       }
  @@ -158,21 +177,24 @@
       /**
       Sets a description in the default locale
       */
  -    public void setDescription( String description ) {
  -        setDescription(description,null);
  +    public void setDescription(String description)
  +    {
  +        setDescription(description, null);
       }
   
       /**
       Sets a description for the given locale
       */
  -    public void setDescription( String description, Locale locale ) {
  -        setProperty("description",locale,description);
  +    public void setDescription(String description, Locale locale)
  +    {
  +        setProperty("description", locale, description);
       }
   
       /**
       Returns the description for the default locale
       */
  -    public String getDescription() {
  +    public String getDescription()
  +    {
           return getDescription(null);
       }
   
  @@ -180,19 +202,25 @@
       Returns the title for the given locale, if the title isn't defined
       in this locale or the locale, return the default title
       */
  -    public String getDescription( Locale locale ) {
  -        String desc = (String)getProperty("description",locale);
  -
  -        if ( ( desc==null ) && ( locale!=null ) )
  -            desc=(String)getProperty("description", null);
  -
  -        if ( desc==null ) desc=DEFAULT_DESCRIPTION;
  +    public String getDescription(Locale locale)
  +    {
  +        String desc = (String) getProperty("description", locale);
  +
  +        if ((desc == null) && (locale != null))
  +        {
  +            desc = (String) getProperty ("description", null);
  +        }
  +
  +        if (desc == null)
  +        {
  +            desc = DEFAULT_DESCRIPTION;
  +        }
   
           return desc;
       }
   
       /**
  -    Stores a property for later retrieval, uses the notation
  +     Stores a property for later retrieval, uses the notation
        propertyName.localeName for locale distinction
   
       <p>For example, title.fr_FR will store the French title, while
  @@ -200,31 +228,54 @@
       which can be used when defaulting because en entry is not present
       for the queried locale</p>
       */
  -    private void setProperty( String name, Locale locale, Object value ) {
  -        if ( name==null ) return;
  -
  -        if ( locale!=null ) name=name+"."+locale.toString();
  -
  -        if ( value==null )
  -            data.remove( name );
  +    private void setProperty(String name, Locale locale, Object value)
  +    {
  +        if (name == null)
  +        {
  +            return;
  +        }
  +
  +        if (locale != null)
  +        {
  +            name = name + "." + locale.toString();
  +        }
  +
  +        if (value == null)
  +        {
  +            data.remove(name);
  +        }
           else
  -            data.put( name, value );
  +        {
  +            data.put(name, value);
  +        }
       }
   
       /**
       Retrieves a property by name for a given locale
       */
  -    private Object getProperty( String name, Locale locale ) {
  -        if ( name==null ) return null;
  +    private Object getProperty(String name, Locale locale)
  +    {
  +        if (name == null)
  +        {
  +            return null;
  +        }
   
           String extname = null;
  -        if ( locale!=null )
  -            extname=name+"."+locale.toString();
  +        if (locale != null)
  +        {
  +            extname = name + "." + locale.toString();
  +        }
   
           Object obj = null;
   
  -        if ( extname!=null ) obj=data.get(extname);
  -        if ( obj==null ) obj=data.get(name);
  +        if (extname != null)
  +        {
  +            obj = data.get(extname);
  +        }
  +        if (obj == null)
  +        {
  +            obj = data.get(name);
  +        }
   
           return obj;
       }
  @@ -232,7 +283,8 @@
       /**
       Retrieves a property by name for a given locale
       */
  -    private Dictionary getProperties() {
  +    private Dictionary getProperties() 
  +    {
           return data;
       }
   
  @@ -241,16 +293,19 @@
       If values are defined in both object for the same key,the one passed as 
       parameter updates the previous one
       */
  -    public void merge( MetaData meta ) {
  +    public void merge(MetaData meta)
  +    {
           Dictionary params = meta.getProperties();
           Enumeration en = params.keys();
   
  -        while( en.hasMoreElements() ) {
  +        while (en.hasMoreElements())
  +        {
               Object key = en.nextElement();
  -            String value = (String)params.get(key);
  +            String value = (String) params.get(key);
               
  -            if ( value != null ) {
  -                this.data.put(key,value);
  +            if (value != null)
  +            {
  +                this.data.put(key, value);
               }
           }
       }
  
  
  

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


Mime
View raw message