Examples of SerializerRegistry


Examples of com.skaringa.javaxml.serializers.SerializerRegistry

      throw new SerializerException(
        "wrong context: obj needs to be of type Class, but is: "
          + obj.getClass().getName());
    }

    SerializerRegistry reg = SerializerRegistry.getInstance();

    ComponentSerializer ser = reg.getSerializer(type);

    output.startDocument();
    output.startElement("xsd:schema");

    AttrImpl attr = new AttrImpl();
    attr.addAttribute("name", ser.getXMLTypeName());
    attr.addAttribute("type", ser.getXMLTypeName());
    attr.addAttribute("nillable", "true");
    output.startElement("xsd:element", attr);
    output.endElement("xsd:element");

    // get and document all used classes
    _dependendClasses.add(type);
    Set usedClasses = new HashSet();

    Iterator it = _dependendClasses.iterator();
    while (it.hasNext()) {
      Class aClass = (Class) it.next();
      ser = reg.getSerializer(aClass);
      ser.addUsedClasses(aClass, usedClasses);
    }

    documentUsedClasses(usedClasses, output);
View Full Code Here

Examples of com.skaringa.javaxml.serializers.SerializerRegistry

  private void documentUsedClasses(
    Collection theClasses,
    DocumentOutputHandlerInterface output)
    throws SerializerException {

    SerializerRegistry reg = SerializerRegistry.getInstance();
    Iterator it = theClasses.iterator();
    while (it.hasNext()) {
      Class type = (Class) it.next();
      ComponentSerializer ser = reg.getSerializer(type);

      ser.writeXMLTypeDefinition(type, getPropertyMap(), output);
    }
  }
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

    public static Element[] convertToElements(Object[] properties,
                                              Class type,
                                              QName qname)
        throws SoapFault
    {
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(type);       
        Element[] xml = new Element[properties.length];
       
        for (int n = 0; n < properties.length; ++n)
            xml[n] = ser.toXML(properties[n], qname);
       
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

     *
     */
    public static Object convertToObjects(Element[] properties, Class type)
        throws BaseFault
    {
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer deser = registry.getSerializer(type);
       
        Object objects = Array.newInstance(type, properties.length);
       
        try
        {
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

        throws SoapFault
    {
        if (theClass == null || theClass == Void.TYPE)
            return null;
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer deser = registry.getSerializer(theClass);
        return deser.fromXML(xml);
    }
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

        if (obj == null)
        return XmlUtils.createElement(qname);
     
        Class theClass = obj.getClass();
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(theClass);
       
        Element xml = ser.toXML(obj, qname);
       
        //
        // HACK: Workaround to reuse serializers intended for MessageHandlers
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

                method.getName(), new Integer(parameters.length), new Integer(elements.length)       
            };
            throw new SoapFault(_MESSAGES.get("IncorrectParams", filler));
        }

        SerializerRegistry registry = SerializerRegistry.getInstance();
       
        //
        // general case: apply appropriate serializer to each child element
        //
        for (int i = 0; i < elements.length; ++i)
        {
            Serializer ser = registry.getSerializer(parameters[i]);
            objects[i] = ser.fromXML(elements[i]);
        }
       
        return objects;
    }
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

        //
        // for all non-void methods, we need to find the serializer
        // for the return type, then determine if it's an array and
        // deal with it accordingly
        //
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(returnType);
       
        QName returnValueName = getReturnValueName();
        QName responseBodyName = getResponseName();
        boolean isComplex = true;
       
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

            // put all custom serializers in the serializer registry
            //
            Collection serializerDefinitions = dd.getSerializerDefinitions();
            Iterator i = serializerDefinitions.iterator();
           
            SerializerRegistry registry = SerializerRegistry.getInstance();
           
            while (i.hasNext())
            {
                SerializerDefinition next = (SerializerDefinition)i.next();
               
                Serializer ser = next.create();
                Class type = ser.getSerializableType();
               
                Class arrayType = ReflectUtils.getArrayClassFromClass(type);
                Serializer arraySer = new ArraySerializer(arrayType, ser);
               
                registry.registerSerializer(type, ser);
                registry.registerSerializer(arrayType, arraySer);
            }
           
            //
            // create the router, which will instantiate resources that
            // are specified in the deployment descriptor (using the
View Full Code Here

Examples of org.apache.muse.core.serializer.SerializerRegistry

            type = value.getClass();
        }
       
        Element[] properties = new Element[values.length];
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(type);
       
        for (int n = 0; n < values.length; ++n)
            properties[n] = serializeValue(ser, values[n], name);
       
        return properties;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.