<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>
// Generated from examples.xsd // On Wed Jun 09 11:15:21 EDT 2004 package examples; public class InternationalPrice implements java.io.Serializable { public InternationalPrice() {} private java.math.BigDecimal __value; public java.math.BigDecimal get_value() { | return __value; } public void set_value(java.math.BigDecimal _valueVal) { | __value = _valueVal; } public java.lang.String toString() { return getContent(get_value()); } protected static java.lang.String getContent(java.math.BigDecimal val) { return examples.InternationalPriceMarshaler.serializeBigDecimal(val); } public boolean equals(java.lang.Object object) { | if (object == null) return false; | if (!(examples.InternationalPrice.class.isAssignableFrom(object.getClass()))) return false; | examples.InternationalPrice obj = (examples.InternationalPrice) object; | | if (_Currency == null) { | | if (obj._Currency != null) return false; | } else if (!_Currency.equals(obj._Currency)) return false; | | | | if (!obj.get_value().equals(get_value())) return false; | return true; } public int hashCode() { return toString().hashCode(); } private java.lang.String _Currency = "USD"; public java.lang.String getCurrency() { | return _Currency; } public void setCurrency(java.lang.String CurrencyVal) { | _Currency = CurrencyVal; } }
// Generated from examples.xsd // On Wed Jun 09 11:15:21 EDT 2004 package examples; public class InternationalPriceMarshaler extends com.sssw.jbroker.web.xsd.mapping.DecimalMarshaler 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.InternationalPrice obj = (examples.InternationalPrice) object; | java.lang.String content = serializeBigDecimal(obj.get_value()); | os.writeContent(content); | } public java.lang.Object deserialize(com.sssw.jbroker.web.portable.InputStream is, java.lang.Class javaType) throws java.io.IOException { | if (!examples.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.InternationalPrice obj = null; | obj = new examples.InternationalPrice(); | java.math.BigDecimal content = examples.InternationalPriceMarshaler.deserializeBigDecimal(is.readContent()); | obj.set_value(content); | 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.InternationalPrice obj = (examples.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; } public static void validate(java.lang.String val) { | com.sssw.jbroker.web.xsd.mapping.DecimalMarshaler.validate(val); } public static void validate(java.math.BigDecimal val) { | com.sssw.jbroker.web.xsd.mapping.DecimalMarshaler.validate(val); } private void deserializeAttributes(examples.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(examples.TestStringMarshaler.deserializeString(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.