Read-only data

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

Read-only data

by bimargulies :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've got an object with some internal state. I want the state to travel
across the wire to a client, and come back, but I don't want a public
setter.

Is there a way of using JAXB annotations to achieve this?

Re: Read-only data

by dkulp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu October 29 2009 5:16:03 pm Benson Margulies wrote:
> I've got an object with some internal state. I want the state to travel
> across the wire to a client, and come back, but I don't want a public
> setter.
>
> Is there a way of using JAXB annotations to achieve this?

I THINK if you use the @XmlAccessorType(XmlAccessType.FIELD) annotation  on
the class and then stick the @XmlElement and stuff annotations on the fields
instead of the methods, then JAXB pretty much will ignore the getter/setter
things and directly inject via the fields.    



--
Daniel Kulp
dkulp@...
http://www.dankulp.com/blog