You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by "Lawrence Jones (JIRA)" <xm...@xml.apache.org> on 2006/04/08 00:45:26 UTC

[jira] Created: (XMLBEANS-263) Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long

Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long
---------------------------------------------------------------------------------------------------

         Key: XMLBEANS-263
         URL: http://issues.apache.org/jira/browse/XMLBEANS-263
     Project: XMLBeans
        Type: New Feature

  Components: Binding  
    Versions: Version 2.1    
 Environment: All
    Reporter: Lawrence Jones


For getters/setters which take/return fundamental types (e.g. long) user would like to generate the Wrapper types (e.g. java.lang.Long). See mail below.

> -----Original Message-----
> From: Ramona Krickan [mailto:ramona.krickan@zooplus.de]
> Sent: Friday, April 07, 2006 2:01 AM
> To: dev@xmlbeans.apache.org
> Subject: AW: Wrapper classes instead of primitive types in the Generated
> classes
> 
> Hello Lawrence,
> 
> thank you very much for your help. It helped me understand the basic
> concept
> - why you are using XmlLong and the other classes.
> But what I didn't really understand is why you don't use java.lang.Long
> for
> convenience, but the primitive type long.
> 
> My Problem is the following:
> I am working with ibatis (ORM-Tool). For this tool I write xml-mapping
> files, so called sql-maps, where I specify a class with its properties.
> So when I query my Database, ibatis looks at this mapping file and then
> searches for the specified class. When it found the class it creates an
> instance and fills in the propertys with the help of the getter and setter
> methods.
> The problem is that the ORM-Tools work with the Wrapper classes because
> there a null is possible. If for example a database identifier has null as
> its value, the ORM-Tool knows that it still has to save this Object to the
> database, if the value is not null, but for example 0, then the ORM-Tool
> thinks that the Object is already persistent.
> Because there are so many classes we just need once, we want to have them
> generated from XmlBeans.
> Because of this Problem, neither the primitive type nor the Xml... classes
> work for us.
> 
> To solve this problem for us, I have changed the source code a bit, but
> that
> isn't a really code solution because with each new release from XmlBeans,
> we
> have to adjust the code again.
> A nice solution for this specific problem we found with JAXB. There you
> can
> specify user definded type within annotations. Is there a plan to
> implement
> this feature in XmlBeans? Or is there anything that speaks against it? If
> there is nothing that speaks against it, I would like to implement the
> JAXB
> Standard of specifying user defined types in XmlBeans, but for doing that
> I
> need help.
> 
> I hope I could clearly state my problem and you can help me.
> 
> Greetings,
> Ramona


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


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


[jira] Commented: (XMLBEANS-263) Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long

Posted by "Ed (JIRA)" <xm...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLBEANS-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12612364#action_12612364 ] 

Ed commented on XMLBEANS-263:
-----------------------------

I think wrapper types make sense for optional attribute/element

for example, if I have an xsd:

<xsd:element name="ElementA">
<xsd:attribute name="AttA" type="xsd:unsignedLong"/>
<xsd:attribute name="AttB" type="xsd:unsignedLong" use="required"/>
</xsd:element>

and data:

<ElementA attB="10"/>

elementA.getAttA() should return java.lang.Long because it is nullable. A 0 primitive returned by this class doesn't seem consistent as it is not equivalent to null and not the same as <ElementA attA="0" attB="10"/>.

Only way to avoid this seems be to use the xget...() methods or for this case elementA.xgetAttA() for all optional primitive attributes.

> Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long
> ---------------------------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-263
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-263
>             Project: XMLBeans
>          Issue Type: New Feature
>          Components: Binding
>    Affects Versions: Version 2.1
>         Environment: All
>            Reporter: Lawrence Jones
>
> For getters/setters which take/return fundamental types (e.g. long) user would like to generate the Wrapper types (e.g. java.lang.Long). See mail below.
> > -----Original Message-----
> > From: Ramona Krickan [mailto:ramona.krickan@zooplus.de]
> > Sent: Friday, April 07, 2006 2:01 AM
> > To: dev@xmlbeans.apache.org
> > Subject: AW: Wrapper classes instead of primitive types in the Generated
> > classes
> > 
> > Hello Lawrence,
> > 
> > thank you very much for your help. It helped me understand the basic
> > concept
> > - why you are using XmlLong and the other classes.
> > But what I didn't really understand is why you don't use java.lang.Long
> > for
> > convenience, but the primitive type long.
> > 
> > My Problem is the following:
> > I am working with ibatis (ORM-Tool). For this tool I write xml-mapping
> > files, so called sql-maps, where I specify a class with its properties.
> > So when I query my Database, ibatis looks at this mapping file and then
> > searches for the specified class. When it found the class it creates an
> > instance and fills in the propertys with the help of the getter and setter
> > methods.
> > The problem is that the ORM-Tools work with the Wrapper classes because
> > there a null is possible. If for example a database identifier has null as
> > its value, the ORM-Tool knows that it still has to save this Object to the
> > database, if the value is not null, but for example 0, then the ORM-Tool
> > thinks that the Object is already persistent.
> > Because there are so many classes we just need once, we want to have them
> > generated from XmlBeans.
> > Because of this Problem, neither the primitive type nor the Xml... classes
> > work for us.
> > 
> > To solve this problem for us, I have changed the source code a bit, but
> > that
> > isn't a really code solution because with each new release from XmlBeans,
> > we
> > have to adjust the code again.
> > A nice solution for this specific problem we found with JAXB. There you
> > can
> > specify user definded type within annotations. Is there a plan to
> > implement
> > this feature in XmlBeans? Or is there anything that speaks against it? If
> > there is nothing that speaks against it, I would like to implement the
> > JAXB
> > Standard of specifying user defined types in XmlBeans, but for doing that
> > I
> > need help.
> > 
> > I hope I could clearly state my problem and you can help me.
> > 
> > Greetings,
> > Ramona

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (XMLBEANS-263) Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long

Posted by "Radu Preotiuc-Pietro (JIRA)" <xm...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XMLBEANS-263?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652089#action_12652089 ] 

Radu Preotiuc-Pietro commented on XMLBEANS-263:
-----------------------------------------------

I think between using xget() and isNil() there already are ways to get the information. Most people would need to special-case the null case anyway, so the benefit is minimal and we would like to keep the mapping simple: xs:long maps to Java long all the time.

> Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long
> ---------------------------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-263
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-263
>             Project: XMLBeans
>          Issue Type: New Feature
>          Components: Binding
>    Affects Versions: Version 2.1
>         Environment: All
>            Reporter: Lawrence Jones
>
> For getters/setters which take/return fundamental types (e.g. long) user would like to generate the Wrapper types (e.g. java.lang.Long). See mail below.
> > -----Original Message-----
> > From: Ramona Krickan [mailto:ramona.krickan@zooplus.de]
> > Sent: Friday, April 07, 2006 2:01 AM
> > To: dev@xmlbeans.apache.org
> > Subject: AW: Wrapper classes instead of primitive types in the Generated
> > classes
> > 
> > Hello Lawrence,
> > 
> > thank you very much for your help. It helped me understand the basic
> > concept
> > - why you are using XmlLong and the other classes.
> > But what I didn't really understand is why you don't use java.lang.Long
> > for
> > convenience, but the primitive type long.
> > 
> > My Problem is the following:
> > I am working with ibatis (ORM-Tool). For this tool I write xml-mapping
> > files, so called sql-maps, where I specify a class with its properties.
> > So when I query my Database, ibatis looks at this mapping file and then
> > searches for the specified class. When it found the class it creates an
> > instance and fills in the propertys with the help of the getter and setter
> > methods.
> > The problem is that the ORM-Tools work with the Wrapper classes because
> > there a null is possible. If for example a database identifier has null as
> > its value, the ORM-Tool knows that it still has to save this Object to the
> > database, if the value is not null, but for example 0, then the ORM-Tool
> > thinks that the Object is already persistent.
> > Because there are so many classes we just need once, we want to have them
> > generated from XmlBeans.
> > Because of this Problem, neither the primitive type nor the Xml... classes
> > work for us.
> > 
> > To solve this problem for us, I have changed the source code a bit, but
> > that
> > isn't a really code solution because with each new release from XmlBeans,
> > we
> > have to adjust the code again.
> > A nice solution for this specific problem we found with JAXB. There you
> > can
> > specify user definded type within annotations. Is there a plan to
> > implement
> > this feature in XmlBeans? Or is there anything that speaks against it? If
> > there is nothing that speaks against it, I would like to implement the
> > JAXB
> > Standard of specifying user defined types in XmlBeans, but for doing that
> > I
> > need help.
> > 
> > I hope I could clearly state my problem and you can help me.
> > 
> > Greetings,
> > Ramona

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (XMLBEANS-263) Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long

Posted by "Cezar Andrei (JIRA)" <xm...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XMLBEANS-263?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cezar Andrei resolved XMLBEANS-263.
-----------------------------------

    Resolution: Won't Fix

See Radu's last comment.

> Would like to have methods to get/set fundamental types as Java wrapper objects e.g. java.lang.Long
> ---------------------------------------------------------------------------------------------------
>
>                 Key: XMLBEANS-263
>                 URL: https://issues.apache.org/jira/browse/XMLBEANS-263
>             Project: XMLBeans
>          Issue Type: New Feature
>          Components: Binding
>    Affects Versions: Version 2.1
>         Environment: All
>            Reporter: Lawrence Jones
>
> For getters/setters which take/return fundamental types (e.g. long) user would like to generate the Wrapper types (e.g. java.lang.Long). See mail below.
> > -----Original Message-----
> > From: Ramona Krickan [mailto:ramona.krickan@zooplus.de]
> > Sent: Friday, April 07, 2006 2:01 AM
> > To: dev@xmlbeans.apache.org
> > Subject: AW: Wrapper classes instead of primitive types in the Generated
> > classes
> > 
> > Hello Lawrence,
> > 
> > thank you very much for your help. It helped me understand the basic
> > concept
> > - why you are using XmlLong and the other classes.
> > But what I didn't really understand is why you don't use java.lang.Long
> > for
> > convenience, but the primitive type long.
> > 
> > My Problem is the following:
> > I am working with ibatis (ORM-Tool). For this tool I write xml-mapping
> > files, so called sql-maps, where I specify a class with its properties.
> > So when I query my Database, ibatis looks at this mapping file and then
> > searches for the specified class. When it found the class it creates an
> > instance and fills in the propertys with the help of the getter and setter
> > methods.
> > The problem is that the ORM-Tools work with the Wrapper classes because
> > there a null is possible. If for example a database identifier has null as
> > its value, the ORM-Tool knows that it still has to save this Object to the
> > database, if the value is not null, but for example 0, then the ORM-Tool
> > thinks that the Object is already persistent.
> > Because there are so many classes we just need once, we want to have them
> > generated from XmlBeans.
> > Because of this Problem, neither the primitive type nor the Xml... classes
> > work for us.
> > 
> > To solve this problem for us, I have changed the source code a bit, but
> > that
> > isn't a really code solution because with each new release from XmlBeans,
> > we
> > have to adjust the code again.
> > A nice solution for this specific problem we found with JAXB. There you
> > can
> > specify user definded type within annotations. Is there a plan to
> > implement
> > this feature in XmlBeans? Or is there anything that speaks against it? If
> > there is nothing that speaks against it, I would like to implement the
> > JAXB
> > Standard of specifying user defined types in XmlBeans, but for doing that
> > I
> > need help.
> > 
> > I hope I could clearly state my problem and you can help me.
> > 
> > Greetings,
> > Ramona

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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