This content has been marked as final.
Show 4 replies
-
1. Re: Hide certain fields in return object
peterj Aug 7, 2008 11:12 AM (in response to craiggreenhalgh)Try marking them as transient:
private transient String password;
Such fields will not be serialized. -
2. Re: Hide certain fields in return object
craiggreenhalgh Aug 7, 2008 12:30 PM (in response to craiggreenhalgh)No I still need them persisted, just dont want to pass them back via a web service. For example why would @Version be sent back? It is not use to the user
Any ideas?
Thanks -
3. Re: Hide certain fields in return object
asoldano Aug 8, 2008 3:01 AM (in response to craiggreenhalgh)Did you try using @XmlTransient jaxb annotation?
-
4. Re: Hide certain fields in return object
kosulin Aug 12, 2008 9:08 AM (in response to craiggreenhalgh)Not sure this is what you want, but if I need to send some attribute only if it is not empty, then I declare it as:
@XmlElement(name = "StatementDate", required = false)
public final Date getStmtDate()
{
return this.stmtDate;
}
If I want the the attribute to be sent even if it is empty, I use nillable=true
This would not work if you want to prevent a non-empty attribute from being sent though.