cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: nillable? required?
Date Wed, 22 Jun 2011 03:21:03 GMT
On Monday, June 20, 2011 9:17:38 PM Anthony Webster wrote:
> Hi,
> 
> Here's a quick (hopefully) question. Is it possible to ensure that function
> parameters are always non-null? It would be cool if I didn't have to perform
> a whole bunch of checks on the server-side and just assume that incoming
> requests don't contain null arguments (at least in cases where null values
> make no sense - addContact(null) or whatever). I assumed that putting an
> @XmlElement(required = true, nillable = false) on my business objects would
> do the trick but I can still pass null arguments using my CXF test rig and
> they go straight through to the server-side method implementation.
> 
> Maybe I'm missing the point somewhere...
> 
> Any ideas?

JAXB, by default, doesn't do any schema validation.   The 
nillable=false/required=true stuff really just affects the schema that is 
generated.   If you want to enforce that stuff, you would need to turn on the 
schema validation.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Mime
View raw message