TIBCOSoftware / genxdm

GenXDM: XQuery/XPath Data Model API, bridges, and processors for tree-model neutral access to XML.
http://www.genxdm.org/
9 stars 4 forks source link

Provide an API to return a Atom from a java typed value given its Native Type #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Provide a utility API in AtomBridge that takes a NativeType type, Object value 
and returns the XmlAtom.

A atom(NativeType type, Object value)

Original issue reported on code.google.com by ravi.pra...@gmail.com on 6 Aug 2012 at 5:52

GoogleCodeExporter commented 9 years ago
Not a defect, an enhancement.

After getting a bit more information from the submitter and team, it seems that 
users want to be able to pass a Java object (which may be a boxed primitive, 
such as int/Integer) to a bridge and get an <A>tom (not necessarily an 
XmlAtom!) back. Moreover, it appears that this is viewed as a convenience 
method: instead of each user writing a switch() for the kind of object, then 
calling an appropriate CreateXyzzy() method on the bridge, they want to pass 
the object and the desired NativeType in, and get the appropriate atom back.

Though a convenience method, it's a reasonable one, putting one bit of complex 
stuff in a single implementation location, rather than forcing it to be 
rewritten more-or-less identically by every user who wants to do this. Note 
that though the report requests an API change, it would also be possible to 
write a little utility class that, given NativeType, Object, and AtomBridge, 
could choose the appropriate method on AtomBridge to call. No request is made 
to change the available methods (and thus, native types and supported objects) 
that are already found on AtomBridge.

Original comment by aale...@gmail.com on 6 Aug 2012 at 8:24

GoogleCodeExporter commented 9 years ago
set milestone.

Original comment by aale...@gmail.com on 9 Aug 2012 at 4:17

GoogleCodeExporter commented 9 years ago
this appears to be something that will better be done by the application or 
group that wants to convert from particular java native types to particular xml 
schema types. i don't think a generic solution is possible.

Original comment by aale...@gmail.com on 15 Nov 2012 at 3:15