<xsd:element name="internationalPrice"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="xsd:decimal"> <xsd:attribute name="currency" type="xsd:string" form="qualified" default="USD"/> </xsd:extension> </xsd:simpleContent> </xsd:complexType> </xsd:element>
// Generated from complex.xsd // On Mon Dec 08 11:11:33 EST 2003 package complex; 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 (!(complex.InternationalPrice.class.isAssignableFrom(object.getClass()))) return false; | complex.InternationalPrice obj = (complex.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, usesetValue
*/ public void setContent(java.lang.String val) { setValue(new complex.InternationalPrice(val).getValue()); } private java.lang.String _currency = new java.lang.String("USD"); public java.lang.String getCurrency() { | return _currency; } public void setCurrency(java.lang.String currencyVal) { | _currency = currencyVal; } }
// Generated from complex.xsd // On Mon Dec 08 11:11:33 EST 2003 package complex; 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 { | complex.InternationalPrice obj = (complex.InternationalPrice) object; | os.writeContent(obj.toString()); } public java.lang.Object deserialize(com.sssw.jbroker.web.portable.InputStream is, java.lang.Class javaType) throws java.io.IOException { | if (!complex.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()); | complex.InternationalPrice obj = null; | obj = (complex.InternationalPrice) new complex.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; | complex.InternationalPrice obj = (complex.InternationalPrice) object; | | if (obj.getCurrency() != null) { | | qname = _CURRENCY; | | attVal = 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; } private void deserializeAttributes(complex.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(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 © 2000-2003, Novell, Inc. All rights reserved. |