commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/beanutils/src/java/org/apache/commons/beanutils DynaProperty.java
Date Wed, 27 Aug 2003 19:48:23 GMT
rdonkin     2003/08/27 12:48:23

  Modified:    beanutils/src/java/org/apache/commons/beanutils
                        DynaProperty.java
  Log:
  Alfonso noticed that every key for a DynaBean mapped property must be type String - something
I missed when I added this functionality originally (Doh!). Removing this introduced an imcompatibility
in the nightlies but this is better off being removed before it's released. Patch submitted
by Alfonso da Silva.
  
  Revision  Changes    Path
  1.9       +18 -58    jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaProperty.java
  
  Index: DynaProperty.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/beanutils/src/java/org/apache/commons/beanutils/DynaProperty.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DynaProperty.java	21 Aug 2003 21:31:56 -0000	1.8
  +++ DynaProperty.java	27 Aug 2003 19:48:22 -0000	1.9
  @@ -75,6 +75,13 @@
   /**
    * <p>The metadata describing an individual property of a DynaBean.</p>
    *
  + * <p>The meta contains an <em>optional</em> content type property ({@link
getContentType})
  + * for use by mapped and iterated properties. 
  + * A mapped or iterated property may choose to indicate the type it expects.
  + * The DynaBean implementation may choose to enforce this type on its entries.
  + * Alternatively, an implementatin may choose to ignore this property.
  + * All keys for maps must be of type String so no meta data is needed for map keys.</p>
  + *
    * @author Craig R. McClanahan
    * @version $Revision$ $Date$
    */
  @@ -131,12 +138,12 @@
       }
       
       /**
  -     * Construct an indexed <code>DynaProperty</code> that supports (pseudo)-introspection
  -     * of the indexed property type.
  +     * Construct an indexed or mapped <code>DynaProperty</code> that supports
(pseudo)-introspection
  +     * of the content type.
        *
        * @param name Name of the property being described
        * @param type Java class representing the property data type
  -     * @param contentType Class that all indexed elements are instances of
  +     * @param contentType Class that all indexed or mapped elements are instances of
        */
       public DynaProperty(String name, Class type, Class contentType) {
   
  @@ -147,25 +154,6 @@
           
       }
   
  -    /**
  -     * Construct a mapped <code>DynaProperty</code> that supports (pseudo)-introspection
  -     * of the mapped content and key type.
  -     *
  -     * @param name Name of the property being described
  -     * @param type Java class representing the property data type
  -     * @param keyType Class that all keys are instances of
  -     * @param contentType Class that all mapped elements are instances of
  -     */
  -    public DynaProperty(String name, Class type, Class keyType, Class contentType) {
  -
  -        super();
  -        this.name = name;
  -        this.type = type;
  -        this.keyType = keyType;
  -        this.contentType = contentType;
  -        
  -    }
  -
       // ------------------------------------------------------------- Properties
   
       /** Property name */
  @@ -211,24 +199,6 @@
           return contentType;
       }
       
  -    
  -    /** The <em>(optional)</em> type of keys for mapped <code>DynaProperty</code>'s
*/
  -    protected transient Class keyType;
  -    /**
  -     * Gets the <em>(optional)</em> type of the key for mapped <code>DynaProperty</code>'s
  -     * that support this feature.
  -     *
  -     * <p>There are issues with serializing primitive class types on certain JVM
versions
  -     * (including java 1.3).
  -     * Therefore, this field <strong>must not be serialized using the standard methods</strong>.</p>
  -     *
  -     * @return the Class for the key type if this is an mapped <code>DynaProperty</code>

  -     * and this feature is supported. Otherwise null.
  -     */
  -    public Class getKeyType() {
  -        return keyType;
  -    }
  -
       // --------------------------------------------------------- Public Methods
   
   
  @@ -273,10 +243,8 @@
           sb.append(this.name);
           sb.append(",type=");
           sb.append(this.type);
  -        if (isIndexed()) {
  +        if (isMapped() || isIndexed()) {
               sb.append(" <").append(this.contentType).append(">");
  -        } else if (isMapped()) {
  -            sb.append(" <").append(this.keyType).append(",").append(this.contentType).append(">");
           }
           sb.append("]");
           return (sb.toString());
  @@ -295,11 +263,7 @@
           
           writeAnyClass(this.type,out);
           
  -        if (isIndexed()) {
  -            writeAnyClass(this.contentType,out);
  -        }
  -        else if (isMapped()) {
  -            writeAnyClass(this.keyType,out);
  +        if (isMapped() || isIndexed()) {
               writeAnyClass(this.contentType,out);
           }
           
  @@ -354,11 +318,7 @@
           
           this.type = readAnyClass(in);
           
  -        if (isIndexed()) {
  -            this.contentType = readAnyClass(in);
  -        }
  -        else if (isMapped()) {
  -            this.keyType = readAnyClass(in);
  +        if (isMapped() || isIndexed()) {
               this.contentType = readAnyClass(in);
           }
           
  @@ -397,4 +357,4 @@
               return ((Class) in.readObject());
           }
       }
  -}
  +}
  \ No newline at end of file
  
  
  

Mime
View raw message