users@jaxb.java.net

Does jaxb 2.1 enforce xs:restriction

From: chamibuddhika <chamibuddhika_at_gmail.com>
Date: Thu, 8 Jan 2009 01:29:17 -0800 (PST)

Hi,

I've got a schema with following element.

<xs:element name="Amount">
                                <xs:simpleType>
                                        <xs:restriction base="xs:int">
                                                <xs:minExclusive value="1"></xs:minExclusive>
                                                <xs:maxExclusive value="1000000"></xs:maxExclusive>
                                        </xs:restriction>
                                </xs:simpleType>
</xs:element>

In the generated java class the setter method does not enforce the
restriction when setting a value to the amount variable allowing any value
to be assigned to Amount.

public void setAmount(int value) {
        this.amount = value;
}

I'm programmatically generating source files from SchemaCompiler class and
using jaxb 2.1. I'm new to JAXB and may be missing some obvious point. Can
anybody please explain how this restriction can be enforced. I've attached
the generated source file for reference as well.
http://www.nabble.com/file/p21348458/LoanServiceRequest.java
LoanServiceRequest.java

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/Does-jaxb-2.1-enforce-xs%3Arestriction-tp21348458p21348458.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.