I have a web sercice method that recieves an object. One of the attributes is
"interval" which is an integer.

I would like to make this atribute required but without providing any
default value - I want the user to be required to explicitly set a value.

If I use int interval - the attribute is exposed as int and if the user does
not explicitly set the attribute, a zero (Java default for primitive int)
will be sent.

If I use Integer interval - the attribute is exposed as Integer and is
declared optional in the WSDL so the user can't see it is required before
sending the request.

If I use Integer interval with @XmlElement(required = true) or
@XmlElement(nillable = false) - the attribute is exposed as int.

The attribute can have any integer - negative, zero and positive so I can't
use a default value to indicate that the attribute was not explicitly set.

I can use BigInteger interval with @XmlElement(required = true) but than we
are missing the advantages of using the core type Integer.

I would like to expose the attribute as Integer so I will get null if the
user did not set the attribute and at the same time I would like the WSDL to
expose that the attribute is required so users will know it is required
simply by looking at the WSDL.

--
View this message in context: 
http://cxf.547215.n5.nabble.com/How-to-declare-an-attribute-required-and-non-primitive-tp4815370p4815370.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to