Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] MOXy: mapping constant values?

There is a ConstantTransformer that can be used with an
XMLTransformationMapping that may solve your requirement (you will need to
add this transformer through an amendment method if using the MW).  There is
also a document preservation feature see,
XMLDescriptor.setShouldPreserveDocument().



amphoras wrote:
> 
> Hi,
> 
> The situation I have is that there are some constant values that I want to
> appear in my XML output document (like application=Foo).  I don't want
> this value to be affected by unmarshalling.  How does one map this kind of
> "constant"?
> 
> After playing around with EclipseLink, it looks like even though this
> value is supposed to be a constant, I need to create a variable for it in
> my domain object in order to create a mapping to the proper XPath.  But
> then what should I do?  I don't want this variable's value to change by
> unmarshalling.  I can write an afterLoad method to reset the variable back
> to its original value.  That way when I marshall the object, the correct
> value will be output in the XML.  But is there a better way to do this? 
> Does EclipseLink support one-way mappings or marshalling constants?
> 
> Thanks!
> --Polly
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/MOXy%3A-mapping-constant-values--tp17763195p17777295.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top