FileDocCategorySizeDatePackage
EnumSerializer.javaAPI DocApache Axis 1.43057Sat Apr 22 18:57:28 BST 2006org.apache.axis.encoding.ser

EnumSerializer

public class EnumSerializer extends SimpleSerializer
Serializer for a JAX-RPC enum.
author
Rich Scheuerle
author
Sam Ruby

Fields Summary
protected static Log
log
private Method
toStringMethod
Constructors Summary
public EnumSerializer(Class javaType, QName xmlType)


         
        super(javaType, xmlType);
    
Methods Summary
public java.lang.StringgetValueAsString(java.lang.Object value, org.apache.axis.encoding.SerializationContext context)

        // Invoke the toString method on the enumeration class and
        // write out the result as a string.
        try {
            if (toStringMethod == null) {
                toStringMethod = javaType.getMethod("toString", null);
            }
            return (String) toStringMethod.invoke(value, null);
        } catch (Exception e) {
            log.error(Messages.getMessage("exception00"), e);
        }
        return null;
    
public voidserialize(javax.xml.namespace.QName name, org.xml.sax.Attributes attributes, java.lang.Object value, org.apache.axis.encoding.SerializationContext context)
Serialize an enumeration

        context.startElement(name, attributes);
        context.writeString(getValueAsString(value, context));
        context.endElement();
    
public org.w3c.dom.ElementwriteSchema(java.lang.Class javaType, org.apache.axis.wsdl.fromJava.Types types)
Return XML schema for the specified type, suitable for insertion into the <types> element of a WSDL document, or underneath an <element> or <attribute> declaration.

param
javaType the Java Class we're writing out schema for
param
types the Java2WSDL Types object which holds the context for the WSDL being generated.
return
a type element containing a schema simpleType/complexType
see
org.apache.axis.wsdl.fromJava.Types

        // Use Types helper method.
        return types.writeEnumType(xmlType, javaType);