db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/metadata DescriptorBase.java
Date Tue, 11 Jan 2005 20:24:26 GMT
tomdz       2005/01/11 12:24:26

  Modified:    src/java/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
                        DescriptorBase.java
  Log:
  Added methods to return all attributes and to return the names of all attributes
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.9.2.1   +26 -2     db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorBase.java
  
  Index: DescriptorBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorBase.java,v
  retrieving revision 1.9
  retrieving revision 1.9.2.1
  diff -u -r1.9 -r1.9.2.1
  --- DescriptorBase.java	4 Apr 2004 23:53:34 -0000	1.9
  +++ DescriptorBase.java	11 Jan 2005 20:24:26 -0000	1.9.2.1
  @@ -16,8 +16,7 @@
    */
   
   import java.io.Serializable;
  -import java.util.HashMap;
  -import java.util.Map;
  +import java.util.*;
   
   /**
    * base class for all Descriptors. It is used to implement the AttributeContainer
  @@ -81,6 +80,31 @@
           return this.getAttribute(attributeName, null);
       }
   
  +    /**
  +     * Returns the attribute map (name, value) of this descriptor. Note that the
  +     * returned map is not modifiable.
  +     * 
  +     * @return The attributes
  +     */
  +    public Map getAttributes()
  +    {
  +        return Collections.unmodifiableMap(attributeMap);
  +    }
  +
  +    /**
  +     * Returns an array of the names of all atributes of this descriptor.
  +     * 
  +     * @return The list of attribute names (will not be <code>null</code>)
  +     */
  +    public String[] getAttributeNames()
  +    {
  +        Set      keys   = (attributeMap == null ? new HashSet() : attributeMap.keySet());
  +        String[] result = new String[keys.size()];
  +
  +        keys.toArray(result);
  +        return result;
  +    }
  +    
       public String toString()
       {
           StringBuffer buf = new StringBuffer();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message