users@jaxb.java.net

xsd:unsignedLong maps to BigInteger or long

From: Fady <fady_at_legsem.com>
Date: Wed, 11 Nov 2009 04:36:42 -0800 (PST)

Hello,

I am getting a different mapping for an xsd:unsignedLong depending on the
usage of totalDigits or maxInclusive, even though these 2 constraints should
be equivalent.

This is the result from xjc:

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB)
Reference Implementation, vJAXB 2.1.3 in JDK 1.6
// See http://java.sun.com/xml/jaxb http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the
source schema.
// Generated on: 2009.11.11 at 01:23:09 PM CET
//


package com.acme.test;

import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for MyType complex type.
 *
 * <p>The following schema fragment specifies the expected content contained
within this class.
 *
 * <pre>
 * &lt;complexType name="MyType">
 * &lt;complexContent>
 * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 * &lt;sequence>
 * &lt;element name="elementTotalDigits">
 * &lt;simpleType>
 * &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}unsignedLong">
 * &lt;totalDigits value="18"/>
 * &lt;/restriction>
 * &lt;/simpleType>
 * &lt;/element>
 * &lt;element name="elementMaxInclusive">
 * &lt;simpleType>
 * &lt;restriction
base="{http://www.w3.org/2001/XMLSchema}unsignedLong">
 * &lt;maxInclusive value="999999999999999999"/>
 * &lt;/restriction>
 * &lt;/simpleType>
 * &lt;/element>
 * &lt;/sequence>
 * &lt;/restriction>
 * &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MyType", propOrder = {
    "elementTotalDigits",
    "elementMaxInclusive"
})
public class MyType {

    @XmlElement(required = true)
    protected BigInteger elementTotalDigits;
    protected long elementMaxInclusive;

    /**
     * Gets the value of the elementTotalDigits property.
     *
     * @return
     * possible object is
     * {_at_link BigInteger }
     *
     */
    public BigInteger getElementTotalDigits() {
        return elementTotalDigits;
    }

    /**
     * Sets the value of the elementTotalDigits property.
     *
     * @param value
     * allowed object is
     * {_at_link BigInteger }
     *
     */
    public void setElementTotalDigits(BigInteger value) {
        this.elementTotalDigits = value;
    }

    /**
     * Gets the value of the elementMaxInclusive property.
     *
     */
    public long getElementMaxInclusive() {
        return elementMaxInclusive;
    }

    /**
     * Sets the value of the elementMaxInclusive property.
     *
     */
    public void setElementMaxInclusive(long value) {
        this.elementMaxInclusive = value;
    }

}

Is this the intended behavior? Shouldn't totalDigits="18" and
maxInclusive="999999999999999999" yield the same Java type?

Thank you.

Fady
-- 
View this message in context: http://old.nabble.com/xsd%3AunsignedLong-maps-to-BigInteger-or-long-tp26300552p26300552.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.