[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-cvs
Subject:    [Jibx-cvs] core/build/src/org/jibx/schema/codegen/extend
From:       Dennis Sosnoski <dsosnoski () users ! sourceforge ! net>
Date:       2009-04-16 11:30:45
Message-ID: E1LuPnp-00039O-Ig () fdv4jf1 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/jibx/core/build/src/org/jibx/schema/codegen/extend
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12107/src/org/jibx/schema/codegen/extend


Modified Files:
	CollectionMethodsDecorator.java 
Log Message:
Use name from 'getXXX' method (the XXX part) as name for sizeXXX() and clearXXX() \
methods, for plural/singular consistency.

Index: CollectionMethodsDecorator.java
===================================================================
RCS file: /cvsroot/jibx/core/build/src/org/jibx/schema/codegen/extend/CollectionMethodsDecorator.java,v
 retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CollectionMethodsDecorator.java	17 Mar 2009 07:46:04 -0000	1.4
--- CollectionMethodsDecorator.java	16 Apr 2009 11:30:43 -0000	1.5
***************
*** 37,42 ****
  
  /**
!  * Code generation decorator which adds <code>sizeXXX()</code>, \
                <code>addXXX(YYY)</code> <code>getXXX(int)</code>,
!  * and <code>clearXXX()</code> methods for each collection value using a \
                <code>java.util.List</code> representation.
   */
  public class CollectionMethodsDecorator implements ClassDecorator
--- 37,45 ----
  
  /**
!  * Code generation decorator which adds <code>sizeXXX()</code>, \
                <code>addXXX(YYY)</code> <code>getXXX(int)</code>, and
!  * <code>clearXXX()</code> methods for each collection value using a \
                <code>java.util.List</code> representation. This
!  * version differs from {@link OriginalCollectionMethodsDecorator} in that the form \
                of the name used for the
!  * <code>sizeXXX()</code> and <code>clearXXX()</code> methods is based on the \
                supplied <code>getXXX()</code> method
!  * which normally uses a plural form of the name.
   */
  public class CollectionMethodsDecorator implements ClassDecorator
***************
*** 44,51 ****
      /** Text for template class. */
      private static final String s_classText = "class Gorph { java.util.List $1; " +
!         "/** Get the number of $0 items.\n * @return count\n */\npublic int \
                size$2() { return $1.size(); }" +
          "/** Add a $0 item.\n * @param item\n */\npublic void add$2($3 item) { \
                $1.add(item); }" +
          "/** Get $0 item by position.\n * @return item\n * @param index\n \
                */\npublic $3 get$2(int index) { return $4$1.get(index); }" +
!         "/** Remove all $0 items.\n */\npublic void clear$2() { $1.clear(); } }";
      // where $0 is the description text, $1 is the field name, $2 is the value name \
                with initial uppercase character,
      //  $3 is the type, and $4 is a cast if an untyped list is used, or empty if a \
                typed list is used
--- 47,54 ----
      /** Text for template class. */
      private static final String s_classText = "class Gorph { java.util.List $1; " +
!         "/** Get the number of $0 items.\n * @return count\n */\npublic int \
                size$5() { return $1.size(); }" +
          "/** Add a $0 item.\n * @param item\n */\npublic void add$2($3 item) { \
                $1.add(item); }" +
          "/** Get $0 item by position.\n * @return item\n * @param index\n \
                */\npublic $3 get$2(int index) { return $4$1.get(index); }" +
!         "/** Remove all $0 items.\n */\npublic void clear$5() { $1.clear(); } }";
      // where $0 is the description text, $1 is the field name, $2 is the value name \
                with initial uppercase character,
      //  $3 is the type, and $4 is a cast if an untyped list is used, or empty if a \
                typed list is used
***************
*** 84,88 ****
      
      /**
!      * Method called after adding each data value to class.
       * 
       * @param basename base name used for data value
--- 87,91 ----
      
      /**
!      * Method called after adding each data value to class. 
       * 
       * @param basename base name used for data value
***************
*** 109,112 ****
--- 112,116 ----
              String cast = field.getType().isParameterizedType() ? "" : ("(" + type \
+ ")");  replace("$4", cast, buff);
+             replace("$5", getmeth.getName().getIdentifier().substring(3), buff);
              
              // parse the resulting text


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Jibx-cvs mailing list
Jibx-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic