[jira] Created: (MODELLO-97) Add constants for tags and attributes in xpp3

View: New views
6 Messages — Rating Filter:   Alert me  

[jira] Created: (MODELLO-97) Add constants for tags and attributes in xpp3

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Add constants for tags and attributes in xpp3
---------------------------------------------

                 Key: MODELLO-97
                 URL: http://jira.codehaus.org/browse/MODELLO-97
             Project: Modello
          Issue Type: Improvement
          Components: modello-plugin-xpp3
    Affects Versions: 1.0-alpha-16
            Reporter: Vincent Siveton
         Attachments: added_public_static_final_fields.diff

I proposed to add constants for tags and attributes, i.e.:

{code:title=MyGeneratedXpp3Reader.java|borderStyle=solid}
public class MavenXpp3Reader {
...
    /**
     * Tag name for <code>myTag</code>.
     */
    public static final java.lang.String TAG_MYTAG = "myTag";

    /**
     * Attribute name for <code>myAttribute</code>.
     */
    public static final java.lang.String ATTRIBUTE_MYATTRIBUTE = "myAttribute";
...
}
{code}

The patch includes:
* added new methods in Xpp3ReaderGenerator class to handle that: addConstantField(...) and getConstantName(...)
* replaces all tagName/singularTagName by getConstantName(...)
* removed unused import
* updated Xpp3WriterGenerator to use the constants defined in the generated Xpp3Reader class
* added a test case

Note: in src/test/java, the package org.codehaus.modello.generator.xml.xpp3 was moved to org.codehaus.modello.plugin.xpp3 like defined in src/main/java

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


[jira] Updated: (MODELLO-97) Add constants for tags and attributes in xpp3

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/MODELLO-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MODELLO-97:
---------------------------------

    Fix Version/s: 1.0

> Add constants for tags and attributes in xpp3
> ---------------------------------------------
>
>                 Key: MODELLO-97
>                 URL: http://jira.codehaus.org/browse/MODELLO-97
>             Project: Modello
>          Issue Type: Improvement
>          Components: modello-plugin-xpp3
>    Affects Versions: 1.0-alpha-16
>            Reporter: Vincent Siveton
>             Fix For: 1.0
>
>         Attachments: added_public_static_final_fields.diff
>
>
> I proposed to add constants for tags and attributes, i.e.:
> {code:title=MyGeneratedXpp3Reader.java|borderStyle=solid}
> public class MavenXpp3Reader {
> ...
>     /**
>      * Tag name for <code>myTag</code>.
>      */
>     public static final java.lang.String TAG_MYTAG = "myTag";
>     /**
>      * Attribute name for <code>myAttribute</code>.
>      */
>     public static final java.lang.String ATTRIBUTE_MYATTRIBUTE = "myAttribute";
> ...
> }
> {code}
> The patch includes:
> * added new methods in Xpp3ReaderGenerator class to handle that: addConstantField(...) and getConstantName(...)
> * replaces all tagName/singularTagName by getConstantName(...)
> * removed unused import
> * updated Xpp3WriterGenerator to use the constants defined in the generated Xpp3Reader class
> * added a test case
> Note: in src/test/java, the package org.codehaus.modello.generator.xml.xpp3 was moved to org.codehaus.modello.plugin.xpp3 like defined in src/main/java

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Updated: (MODELLO-97) Add constants for tags and attributes in xpp3

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/MODELLO-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MODELLO-97:
---------------------------------

    Fix Version/s:     (was: 1.0)
                   1.1

> Add constants for tags and attributes in xpp3
> ---------------------------------------------
>
>                 Key: MODELLO-97
>                 URL: http://jira.codehaus.org/browse/MODELLO-97
>             Project: Modello
>          Issue Type: Improvement
>          Components: modello-plugin-xpp3
>    Affects Versions: 1.0-alpha-16
>            Reporter: Vincent Siveton
>             Fix For: 1.1
>
>         Attachments: added_public_static_final_fields.diff
>
>
> I proposed to add constants for tags and attributes, i.e.:
> {code:title=MyGeneratedXpp3Reader.java|borderStyle=solid}
> public class MavenXpp3Reader {
> ...
>     /**
>      * Tag name for <code>myTag</code>.
>      */
>     public static final java.lang.String TAG_MYTAG = "myTag";
>     /**
>      * Attribute name for <code>myAttribute</code>.
>      */
>     public static final java.lang.String ATTRIBUTE_MYATTRIBUTE = "myAttribute";
> ...
> }
> {code}
> The patch includes:
> * added new methods in Xpp3ReaderGenerator class to handle that: addConstantField(...) and getConstantName(...)
> * replaces all tagName/singularTagName by getConstantName(...)
> * removed unused import
> * updated Xpp3WriterGenerator to use the constants defined in the generated Xpp3Reader class
> * added a test case
> Note: in src/test/java, the package org.codehaus.modello.generator.xml.xpp3 was moved to org.codehaus.modello.plugin.xpp3 like defined in src/main/java

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (MODELLO-97) Add constants for tags and attributes in xpp3

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/MODELLO-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=187296#action_187296 ]

Herve Boutemy commented on MODELLO-97:
--------------------------------------

The idea is interesting: constants should improve generated code (yes, code is generated, there won't be any copy/paste error, but copying/pasting String values is not a good practice).

I have a few concerns about how to implement this idea: why constants in XPP3 only, and not other XML readers/writers? Why constants in reader instead of writer?

Idea: what if modello-plugin-xml generates constants in a separate {{MavenXmlTags}} class or interface in {{io}} package?

Another concern is about conflicting tag names between multiple classes of the model, or recognizing which tag is for which class.
Shouldn't the constants names contain the class name as a prefix?

> Add constants for tags and attributes in xpp3
> ---------------------------------------------
>
>                 Key: MODELLO-97
>                 URL: http://jira.codehaus.org/browse/MODELLO-97
>             Project: Modello
>          Issue Type: Improvement
>          Components: modello-plugin-xpp3
>    Affects Versions: 1.0-alpha-16
>            Reporter: Vincent Siveton
>             Fix For: 1.1
>
>         Attachments: added_public_static_final_fields.diff
>
>
> I proposed to add constants for tags and attributes, i.e.:
> {code:title=MyGeneratedXpp3Reader.java|borderStyle=solid}
> public class MavenXpp3Reader {
> ...
>     /**
>      * Tag name for <code>myTag</code>.
>      */
>     public static final java.lang.String TAG_MYTAG = "myTag";
>     /**
>      * Attribute name for <code>myAttribute</code>.
>      */
>     public static final java.lang.String ATTRIBUTE_MYATTRIBUTE = "myAttribute";
> ...
> }
> {code}
> The patch includes:
> * added new methods in Xpp3ReaderGenerator class to handle that: addConstantField(...) and getConstantName(...)
> * replaces all tagName/singularTagName by getConstantName(...)
> * removed unused import
> * updated Xpp3WriterGenerator to use the constants defined in the generated Xpp3Reader class
> * added a test case
> Note: in src/test/java, the package org.codehaus.modello.generator.xml.xpp3 was moved to org.codehaus.modello.plugin.xpp3 like defined in src/main/java

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Commented: (MODELLO-97) Add constants for tags and attributes in xpp3

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ http://jira.codehaus.org/browse/MODELLO-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=187339#action_187339 ]

Vincent Siveton commented on MODELLO-97:
----------------------------------------

We could add these constants in the reader and the writer (similar to WriterFactory.UTF_8 ReaderFactory.UTF_8 from p-u)
The interface idea could be also a good idea.

> Add constants for tags and attributes in xpp3
> ---------------------------------------------
>
>                 Key: MODELLO-97
>                 URL: http://jira.codehaus.org/browse/MODELLO-97
>             Project: Modello
>          Issue Type: Improvement
>          Components: modello-plugin-xpp3
>    Affects Versions: 1.0-alpha-16
>            Reporter: Vincent Siveton
>             Fix For: 1.1
>
>         Attachments: added_public_static_final_fields.diff
>
>
> I proposed to add constants for tags and attributes, i.e.:
> {code:title=MyGeneratedXpp3Reader.java|borderStyle=solid}
> public class MavenXpp3Reader {
> ...
>     /**
>      * Tag name for <code>myTag</code>.
>      */
>     public static final java.lang.String TAG_MYTAG = "myTag";
>     /**
>      * Attribute name for <code>myAttribute</code>.
>      */
>     public static final java.lang.String ATTRIBUTE_MYATTRIBUTE = "myAttribute";
> ...
> }
> {code}
> The patch includes:
> * added new methods in Xpp3ReaderGenerator class to handle that: addConstantField(...) and getConstantName(...)
> * replaces all tagName/singularTagName by getConstantName(...)
> * removed unused import
> * updated Xpp3WriterGenerator to use the constants defined in the generated Xpp3Reader class
> * added a test case
> Note: in src/test/java, the package org.codehaus.modello.generator.xml.xpp3 was moved to org.codehaus.modello.plugin.xpp3 like defined in src/main/java

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



[jira] Updated: (MODELLO-97) Add constants for tags and attributes in xpp3

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ http://jira.codehaus.org/browse/MODELLO-97?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Herve Boutemy updated MODELLO-97:
---------------------------------

    Fix Version/s:     (was: 1.1)
                   1.2

> Add constants for tags and attributes in xpp3
> ---------------------------------------------
>
>                 Key: MODELLO-97
>                 URL: http://jira.codehaus.org/browse/MODELLO-97
>             Project: Modello
>          Issue Type: Improvement
>          Components: modello-plugin-xpp3
>    Affects Versions: 1.0-alpha-16
>            Reporter: Vincent Siveton
>             Fix For: 1.2
>
>         Attachments: added_public_static_final_fields.diff
>
>
> I proposed to add constants for tags and attributes, i.e.:
> {code:title=MyGeneratedXpp3Reader.java|borderStyle=solid}
> public class MavenXpp3Reader {
> ...
>     /**
>      * Tag name for <code>myTag</code>.
>      */
>     public static final java.lang.String TAG_MYTAG = "myTag";
>     /**
>      * Attribute name for <code>myAttribute</code>.
>      */
>     public static final java.lang.String ATTRIBUTE_MYATTRIBUTE = "myAttribute";
> ...
> }
> {code}
> The patch includes:
> * added new methods in Xpp3ReaderGenerator class to handle that: addConstantField(...) and getConstantName(...)
> * replaces all tagName/singularTagName by getConstantName(...)
> * removed unused import
> * updated Xpp3WriterGenerator to use the constants defined in the generated Xpp3Reader class
> * added a test case
> Note: in src/test/java, the package org.codehaus.modello.generator.xml.xpp3 was moved to org.codehaus.modello.plugin.xpp3 like defined in src/main/java

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email