FileDocCategorySizeDatePackage
DescriptionMetaDataContainer.javaAPI DocJBoss 4.2.13464Fri Jul 13 21:01:18 BST 2007org.jboss.resource.metadata

DescriptionMetaDataContainer

public class DescriptionMetaDataContainer extends Object implements Serializable
An abstract class for meta data that has descriptions
author
Adrian Brock
version
$Revision: 57189 $

Fields Summary
private static final long
serialVersionUID
private EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap
descriptions
The descriptions
Constructors Summary
public DescriptionMetaDataContainer()


    
   
      DescriptionMetaData dmd = new DescriptionMetaData();
      descriptions.put(dmd.getLanguage(), dmd);
   
Methods Summary
public voidaddDescription(DescriptionMetaData dmd)
Add a description

param
dmd the description

      descriptions.put(dmd.getLanguage(), dmd);
   
public DescriptionMetaDatagetDescription()
Get the desription for the default language or the first description if there is no default

return
the description for the default language

      // Try the default locale
      DescriptionMetaData dmd = (DescriptionMetaData) descriptions.get(Locale.getDefault().getLanguage());
      // No description using the default locale, just use the first
      if (dmd == null)
      {
         for (Iterator i = descriptions.values().iterator(); i.hasNext();)
         {
            dmd = (DescriptionMetaData) i.next();
            break;
         }
      }
      return dmd;
   
public DescriptionMetaDatagetDescription(java.lang.String lang)
Get the description for the give language

param
lang the language
return
the description

      return (DescriptionMetaData) descriptions.get(lang);
   
public java.util.CollectiongetDescriptions()
Get the descriptions

return
the descriptions

      return descriptions.values();
   
public java.lang.StringtoString()

      StringBuffer buffer = new StringBuffer();
      buffer.append("DescriptionMetaDataContainer").append('@");
      buffer.append(Integer.toHexString(System.identityHashCode(this)));
      buffer.append("[descriptions=").append(descriptions.values());
      buffer.append(']");
      return buffer.toString();