complexType derivation by extension

schema

    <complexType name="Struct3">
        <complexContent>
            <extension base="structs:Struct2">
                <sequence>
                    <element name="date1" type="xsd:date" default="01-01-01"/>
                    <element name="date2" type="xsd:date" fixed="02-02-02"/>
                    <element name="listelem" type="tns:IntList"/>
                    <element name="enumelem" type="tns:URLType"/>
                </sequence>
            </extension>
        </complexContent>
        <attribute name="att1" type="xsd:date"/>
        <anyAttribute/>
    </complexType>
                                                                           

Struct3 Bean

// Generated from examples.xsd
// On Wed Jun 09 11:15:17 EDT 2004
                                                                           
package examples_olddb;
                                                                           
public class Struct3
    extends examples_olddb.Struct2
    implements java.io.Serializable
{
    public Struct3() {}
                                                                           
    public Struct3(com.sssw.jbroker.web.xsd.Date att1Val, java.lang.Integer elem1Val, examples_olddb.TestString elem2Val, com.sssw.jbroker.web.xsd.Date date1Val, examples_olddb.IntList listelemVal, examples_olddb.URLType enumelemVal) {
    |   setAtt1(att1Val);
    |   setElem1(elem1Val);
    |   setElem2(elem2Val);
    |   setDate1(date1Val);
    |   setListelem(listelemVal);
    |   setEnumelem(enumelemVal);
        }
    public static final com.sssw.jbroker.web.xsd.Date _date2_fixed = get_date2_fixed();
    private static com.sssw.jbroker.web.xsd.Date get_date2_fixed() {
    |   try {
    |   |   return new com.sssw.jbroker.web.xsd.Date("02-02-02");
    |   } catch (Exception e) { throw new RuntimeException(e.getMessage()); }
    }
                                                                           
    public com.sssw.jbroker.web.xsd.Date getDate2() {
    |   return _date2_fixed;
    }
                                                                           
    public void setDate2(com.sssw.jbroker.web.xsd.Date date2Val) {
    |   throw new IllegalArgumentException("Fixed value can not be set!");
    }
                                                                           
    private com.sssw.jbroker.web.xsd.Date _att1;
                                                                           
    public com.sssw.jbroker.web.xsd.Date getAtt1() {
    |   return _att1;
    }
                                                                           
    public void setAtt1(com.sssw.jbroker.web.xsd.Date att1Val) {
    |   _att1 = att1Val;
    }
                                                                           
    private com.sssw.jbroker.web.encoding.Attribute[] _otherAttributes;
                                                                           
    public com.sssw.jbroker.web.encoding.Attribute[] getOtherAttributes() {
    |   return _otherAttributes;
    }
                                                                           
    public void setOtherAttributes(com.sssw.jbroker.web.encoding.Attribute[] otherAttributesVal) {
    |   _otherAttributes = otherAttributesVal;
    }
                                                                           
    private com.sssw.jbroker.web.xsd.Date _date1 = new com.sssw.jbroker.web.xsd.Date("01-01-01");
                                                                           
    public com.sssw.jbroker.web.xsd.Date getDate1() {
    |   return _date1;
    }
                                                                           
    public void setDate1(com.sssw.jbroker.web.xsd.Date date1Val) {
    |   if (date1Val == null) throw new IllegalArgumentException("value can not be null for date1");
    |   _date1 = date1Val;
    }
                                                                           
    private examples_olddb.IntList _listelem;
                                                                           
    public examples_olddb.IntList getListelem() {
    |   return _listelem;
    }
                                                                           
    public void setListelem(examples_olddb.IntList listelemVal) {
    |   if (listelemVal == null) throw new IllegalArgumentException("value can not be null for listelem");
    |   _listelem = listelemVal;
    }
                                                                           
    private examples_olddb.URLType _enumelem;
                                                                           
    public examples_olddb.URLType getEnumelem() {
    |   return _enumelem;
    }
                                                                           
    public void setEnumelem(examples_olddb.URLType enumelemVal) {
    |   if (enumelemVal == null) throw new IllegalArgumentException("value can not be null for enumelem");
    |   _enumelem = enumelemVal;
    }
                                                                           
    public java.lang.String toString() {
    |   java.lang.StringBuffer buffer = new java.lang.StringBuffer();
    |   buffer.append("examples_olddb.Struct3={");
    |   buffer.append("_att1="+_att1);
    |   buffer.append(",");
    |   buffer.append("_date1="+_date1);
    |   buffer.append(",");
    |   buffer.append("_date2_fixed="+_date2_fixed);
    |   buffer.append(",");
    |   buffer.append("_listelem="+_listelem);
    |   buffer.append(",");
    |   buffer.append("_enumelem="+_enumelem);
    |   buffer.append(super.toString());
    |   buffer.append("}");
    |   return buffer.toString();
    }
                                                                           
    public boolean equals(java.lang.Object object) {
    |   if (object == null) return false;
    |   if (!(examples_olddb.Struct3.class.isAssignableFrom(object.getClass()))) return false;
    |   examples_olddb.Struct3 obj = (examples_olddb.Struct3) object;
    |                                                                      
    |   if (_att1 == null) {
    |   |   if (obj._att1 != null) return false;
    |   } else if (!_att1.equals(obj._att1)) return false;
    |                                                                      
    |                                                                      
    |   if (_date1 == null) {
    |   |   if (obj._date1 != null) return false;
    |   } else if (!_date1.equals(obj._date1)) return false;
    |                                                                      
    |   if (_listelem == null) {
    |   |   if (obj._listelem != null) return false;
    |   } else if (!_listelem.equals(obj._listelem)) return false;
    |                                                                      
    |   if (_enumelem == null) {
    |   |   if (obj._enumelem != null) return false;
    |   } else if (!_enumelem.equals(obj._enumelem)) return false;
    |                                                                      
    |                                                                      
    |   return super.equals(obj);
    }
                                                                           
    public int hashCode() { return toString().hashCode(); }
                                                                           
}

Struct3 Marshaler

// Generated from examples.xsd
// On Wed Jun 09 11:15:17 EDT 2004
                                                                           
package examples_olddb;
                                                                           
public class Struct3Marshaler
extends examples_olddb.Struct2Marshaler
 implements com.sssw.jbroker.web.encoding.Marshaler
{
    // attributes
    private static final javax.xml.namespace.QName _ATT1 = new javax.xml.namespace.QName("http://www.structs.com", "att1");
                                                                           
                                                                           
    // elements
    private static final javax.xml.namespace.QName _DATE1 = new javax.xml.namespace.QName("http://www.structs.com", "date1");
    private static final javax.xml.namespace.QName _DATE2 = new javax.xml.namespace.QName("http://www.structs.com", "date2");
    private static final javax.xml.namespace.QName _LISTELEM = new javax.xml.namespace.QName("http://www.structs.com", "listelem");
    private static final javax.xml.namespace.QName _ENUMELEM = new javax.xml.namespace.QName("http://www.structs.com", "enumelem");
                                                                           
    public void serialize(com.sssw.jbroker.web.portable.OutputStream os, java.lang.Object object) throws java.io.IOException
    {
    |   examples_olddb.Struct3 obj = (examples_olddb.Struct3) object;
    |   super.serialize(os, object);
    |                                                                      
    |   // date1
    |   if (obj.getDate1() == null) throw new IllegalArgumentException("value can not be null for date1");
    |   os.writeObject(obj.getDate1(), "", _DATE1.getLocalPart(), "http://www.w3.org/2001/XMLSchema", "date");
    |                                                                      
    |                                                                      
    |   // date2
    |   if (obj.getDate2() == null) throw new IllegalArgumentException("value can not be null for date2");
    |   os.writeObject(obj.getDate2(), "", _DATE2.getLocalPart(), "http://www.w3.org/2001/XMLSchema", "date");
    |                                                                      
    |                                                                      
    |   // listelem
    |   if (obj.getListelem() == null) throw new IllegalArgumentException("value can not be null for listelem");
    |   os.writeObject(obj.getListelem(), "", _LISTELEM.getLocalPart(), "http://www.structs.com", "IntList");
    |                                                                      
    |                                                                      
    |   // enumelem
    |   if (obj.getEnumelem() == null) throw new IllegalArgumentException("value can not be null for enumelem");
    |   os.writeObject(obj.getEnumelem(), "", _ENUMELEM.getLocalPart(), "http://www.structs.com", "URLType");
    |                                                                      
    }
                                                                           
    public java.lang.Object deserialize(com.sssw.jbroker.web.portable.InputStream is, java.lang.Class javaType) throws java.io.IOException
    {
    |   if (!examples_olddb.Struct3.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.Struct3 obj = null;
    |   obj = (examples_olddb.Struct3) super.deserialize(is, javaType);
    |   deserializeAttributes(obj, attributes);
    |   // read elements
    |   com.sssw.jbroker.web.QName  qname  = null;
    |   java.lang.String fName  = null;
    |   qname = is.peek();
    |   com.sssw.jbroker.web.xsd.Date date1 = null;
    |   date1 = (com.sssw.jbroker.web.xsd.Date)is.readObject(com.sssw.jbroker.web.xsd.Date.class, "", _DATE1.getLocalPart(), "http://www.w3.org/2001/XMLSchema", "date");
    |                                                                      
    |   obj.setDate1(date1);
    |                                                                      
    |   qname = is.peek();
    |   com.sssw.jbroker.web.xsd.Date date2 = null;
    |   com.sssw.jbroker.web.xsd.Date date2_fixed = (com.sssw.jbroker.web.xsd.Date)is.readObject(com.sssw.jbroker.web.xsd.Date.class, "", _DATE2.getLocalPart(), "http://www.w3.org/2001/XMLSchema", "date");
    |   if (!obj.getDate2().equals(date2_fixed))
    |       throw new IllegalArgumentException("fixed value not correct: "+date2_fixed);
    |   qname = is.peek();
    |   examples_olddb.IntList listelem = null;
    |   listelem = (examples_olddb.IntList)is.readObject(examples_olddb.IntList.class, "", _LISTELEM.getLocalPart(), "http://www.structs.com", "IntList");
    |                                                                      
    |   obj.setListelem(listelem);
    |                                                                      
    |   qname = is.peek();
    |   examples_olddb.URLType enumelem = null;
    |   enumelem = (examples_olddb.URLType)is.readObject(examples_olddb.URLType.class, "", _ENUMELEM.getLocalPart(), "http://www.structs.com", "URLType");
    |                                                                      
    |   obj.setEnumelem(enumelem);
    |                                                                      
    |                                                                      
    |                                                                      
    |   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.Struct3 obj = (examples_olddb.Struct3) object;
    |                                                                      
    |   com.sssw.jbroker.web.encoding.Attribute[] sattrs = super.getAttributes(object);
    |   if (sattrs != null) {
    |   |   for (int i=0; i < sattrs.length; i++) {
    |   |   |   attribs.add(sattrs[i]);
    |   |   }
    |   }
    |                                                                      
    |   if (obj.getAtt1() != null) {
    |   |   qname = new javax.xml.namespace.QName("", "att1");
    |   |   attVal = java.lang.String.valueOf(obj.getAtt1());
    |   |   attr = new com.sssw.jbroker.web.encoding.Attribute(qname, attVal);
    |   |   attribs.add(attr);
    |   }
    |   attrs = obj.getOtherAttributes();
    |   if (attrs != null) {
    |   |   for(int i =0; i < attrs.length; i++) 
    |   |       attribs.add(attrs[i]);
    |   }
    |                                                                      
    |   attrs = new com.sssw.jbroker.web.encoding.Attribute[attribs.size()];
    |   attribs.toArray(attrs);
    |   return attrs;
    }
                                                                           
    private void deserializeAttributes(examples_olddb.Struct3 obj, java.util.Map attributes)
    throws java.io.IOException
    {
    |   // set attributes
    |   java.lang.String attr = null;
    |                                                                      
    |   attr = (java.lang.String) attributes.get(_ATT1);
    |   if (attr != null) {
    |   |   attributes.remove(_ATT1);
    |   |   obj.setAtt1(new com.sssw.jbroker.web.xsd.Date(attr));
    |   }
    |   deserializeAnyAttributes(obj, attributes);
    }
                                                                           
    private void deserializeAnyAttributes(examples_olddb.Struct3 obj, java.util.Map attributes)
    throws java.io.IOException
    {
    |   javax.xml.namespace.QName attName = null;
    |   javax.xml.namespace.QName attVal = null;
    |   com.sssw.jbroker.web.encoding.Attribute[] attrs = null;
    |   com.sssw.jbroker.web.encoding.Attribute attr = null;
    |                                                                      
    |   attrs = new com.sssw.jbroker.web.encoding.Attribute[attributes.size()];
    |   java.util.Set attSet = attributes.entrySet();
    |   java.util.Iterator it = attSet.iterator();
    |   int i =0;
    |   while(it.hasNext()) {
    |   |   java.util.Map.Entry entry = (java.util.Map.Entry) it.next();
    |   |   attName = (javax.xml.namespace.QName)entry.getKey();
    |   |   attVal = new javax.xml.namespace.QName((java.lang.String)entry.getValue());
    |   |   attr = new com.sssw.jbroker.web.encoding.Attribute(attName, attVal);
    |   |   attrs[i] = attr;
    |   |   i++;
    |   }
    |   obj.setOtherAttributes(attrs);
    }
                                                                           
    private java.util.Map readAttributes(org.xml.sax.Attributes attributes) {
    |   java.util.Map attrs = new java.util.HashMap();
    |   int len = attributes.getLength();
    |   for (int i=0; i < len; i++) {
    |   |   java.lang.String uri = attributes.getURI(i);
    |   |   java.lang.String ln = attributes.getLocalName(i);
    |   |   javax.xml.namespace.QName attName = new javax.xml.namespace.QName(uri, ln);
    |   |   java.lang.String attVal = attributes.getValue(i);
    |   |   if (ln.equalsIgnoreCase("type"))
    |   |       if (uri.equalsIgnoreCase("http://www.w3.org/2001/XMLSchema-instance"))
    |   |           continue;
    |   |   attrs.put(attName, attVal);
    |   }
    |   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.