complexType from simpleContent

Schema

    <xsd:element name="internationalPrice"> 
        <xsd:complexType> 
            <xsd:simpleContent> 
                <xsd:extension base="xsd:decimal"> 
                    <xsd:attribute name="currency" type="tns:TestString" form="qualified" default="USD"/> 
                </xsd:extension> 
            </xsd:simpleContent> 
        </xsd:complexType> 
    </xsd:element>

InternationalPrice Bean

// Generated from examples.xsd
// On Wed Jun 09 11:15:17 EDT 2004
                                                                           
package examples_olddb;
                                                                           
public class InternationalPrice
 implements java.io.Serializable
{
    public InternationalPrice(java.lang.String value) {
    |   if (value == null) throw new IllegalArgumentException("can not instantiate simple type with null value");
    |   java.math.BigDecimal cVal = parse(value);
    |   setValue(cVal);
    }
                                                                           
    public InternationalPrice(java.math.BigDecimal value) {
    |   if (value == null) throw new IllegalArgumentException("can not instantiate simple type with null value");
    |   setValue(value);
    }
                                                                           
    private java.math.BigDecimal _value;
                                                                           
    public java.math.BigDecimal getValue() {
    |   return _value;
    }
                                                                           
    public void setValue(java.math.BigDecimal val) {
    |   if (val == null) throw new IllegalArgumentException("can not set null value for simple content");
    |   _value = val;
    }
                                                                           
    private void validate(java.lang.String val) {
    }
                                                                           
                                                                           
    private void validate(java.math.BigDecimal val) {
    }
                                                                           
    private java.math.BigDecimal parse(java.lang.String val) {
    |   return new java.math.BigDecimal(val);
    }
                                                                           
    public java.lang.String toString() { return getContent(_value); }
                                                                           
    protected static java.lang.String getContent(java.math.BigDecimal val) { return java.lang.String.valueOf(val); }
                                                                           
    public boolean equals(java.lang.Object object) {
    |   if (object == null) return false;
    |   if (!(examples_olddb.InternationalPrice.class.isAssignableFrom(object.getClass()))) return false;
    |   examples_olddb.InternationalPrice obj = (examples_olddb.InternationalPrice) object;
    |                                                                      
    |   if (_currency == null) {
    |   |   if (obj._currency != null) return false;
    |   } else if (!_currency.equals(obj._currency)) return false;
    |                                                                      
    |                                                                      
    |                                                                      
    |   if (!obj._value.equals(_value)) return false;
    |   return true;
    }
                                                                           
    public int hashCode() { return toString().hashCode(); }
                                                                           
    /**@deprecated since jBroker Web 2.0 use getValue*/
    public java.lang.String getContent() { return toString(); }
                                                                           
    /**@deprecated since jBroker Web 2.0, use setValue*/
    public void setContent(java.lang.String val) { setValue(new examples_olddb.InternationalPrice(val).getValue()); }
                                                                           
    private examples_olddb.TestString _currency = new examples_olddb.TestString("USD");
                                                                           
    public examples_olddb.TestString getCurrency() {
    |   return _currency;
    }
                                                                           
    public void setCurrency(examples_olddb.TestString currencyVal) {
    |   _currency = currencyVal;
    }
                                                                           
}

InternationalPrice Marshaler

// Generated from examples.xsd
// On Wed Jun 09 11:15:17 EDT 2004
                                                                           
package examples_olddb;
                                                                           
public class InternationalPriceMarshaler
 implements com.sssw.jbroker.web.encoding.Marshaler
{
    // attributes
    private static final javax.xml.namespace.QName _CURRENCY = new javax.xml.namespace.QName("http://www.structs.com", "currency");
                                                                           
                                                                           
    public void serialize(com.sssw.jbroker.web.portable.OutputStream os, java.lang.Object object) throws java.io.IOException
    {
    |   examples_olddb.InternationalPrice obj = (examples_olddb.InternationalPrice) object;
    |   os.writeContent(object.toString());
    }
                                                                           
    public java.lang.Object deserialize(com.sssw.jbroker.web.portable.InputStream is, java.lang.Class javaType) throws java.io.IOException
    {
    |   if (!examples_olddb.InternationalPrice.class.isAssignableFrom(javaType))
    |       throw new
    |           com.sssw.jbroker.web.ServiceException("can not deserialize " + javaType.getName());
    |                                                                      
    |   // get attributes
    |   java.util.Map attributes = readAttributes(is.getAttributes());
    |   examples_olddb.InternationalPrice obj = null;
    |   obj = new examples_olddb.InternationalPrice(is.readContent());
    |   deserializeAttributes(obj, attributes);
    |                                                                      
    |   return obj;
    }
    public com.sssw.jbroker.web.encoding.Attribute[] getAttributes(java.lang.Object object)
    {
    |   javax.xml.namespace.QName qname = null;
    |   java.lang.String attVal = null;
    |   java.util.ArrayList attribs = new java.util.ArrayList();
    |   com.sssw.jbroker.web.encoding.Attribute[] attrs = null;
    |   com.sssw.jbroker.web.encoding.Attribute attr = null;
    |   examples_olddb.InternationalPrice obj = (examples_olddb.InternationalPrice) object;
    |                                                                      
    |   if (obj.getCurrency() != null) {
    |   |   qname = _CURRENCY;
    |   |   attVal = java.lang.String.valueOf(obj.getCurrency());
    |   |   attr = new com.sssw.jbroker.web.encoding.Attribute(qname, attVal);
    |   |   attribs.add(attr);
    |   }
    |                                                                      
    |   attrs = new com.sssw.jbroker.web.encoding.Attribute[attribs.size()];
    |   attribs.toArray(attrs);
    |   return attrs;
    }
                                                                           
    public static void validate(java.lang.String val) {
    }
                                                                           
                                                                           
    public static void validate(java.math.BigDecimal val) {
    }
                                                                           
    private void deserializeAttributes(examples_olddb.InternationalPrice obj, java.util.Map attributes)
    throws java.io.IOException
    {
    |   // set attributes
    |   java.lang.String attr = null;
    |                                                                      
    |   attr = (java.lang.String) attributes.get(_CURRENCY);
    |   if (attr != null) {
    |   |   attributes.remove(_CURRENCY);
    |   |   obj.setCurrency(new examples_olddb.TestString(attr));
    |   }
    }
                                                                           
    private java.util.Map readAttributes(org.xml.sax.Attributes attributes) {
    |   java.util.Map attrs = new java.util.HashMap();
    |   attrs.put(_CURRENCY, attributes.getValue("http://www.structs.com", "currency"));
    |   return attrs;
    }
                                                                           
                                                                           
    public java.lang.String getMechanismType() { return null; }
}


Copyright © 2003, 2004 Novell, Inc. All rights reserved. Copyright © 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.