Package org.apache.muse.core.serializer

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


        if (content == null)
            throw new NullPointerException(_MESSAGES.get("NullMessageContent"));
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(content.getClass());
        Element xml = ser.toXML(content, qname);
       
        _messageContent.put(qname, xml);
    }
View Full Code Here


        throws SoapFault
    {
        Element content = getMessageContent(qname);
       
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(type);
       
        return ser.fromXML(content);
    }
View Full Code Here

      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);
      }
View Full Code Here

        //
        // use the Muse serializer framework to convert <Notify/> into
        // an array of NotificationMessage objects
        //
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(NotificationMessage[].class);
        Object messageArray = ser.fromXML(xml);
        return new Object[]{ messageArray };
    }
View Full Code Here

     */
    public static Element convertToElement(Object property, Class type, QName qname)
        throws SoapFault
    {
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer ser = registry.getSerializer(type);       
        return ser.toXML(property, qname);
    }
View Full Code Here

     */
    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);
       
        return xml;
    }
View Full Code Here

     */
    public static Object convertToObject(Element property, Class type)
        throws SoapFault
    {
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer deser = registry.getSerializer(type);
        return deser.fromXML(property);
    }
View Full Code Here

     */
    public static Object convertToObjects(Element[] properties, Class type)
        throws SoapFault
    {
        SerializerRegistry registry = SerializerRegistry.getInstance();
        Serializer deser = registry.getSerializer(type);
       
        Object objects = Array.newInstance(type, properties.length);
       
        for (int n = 0; n < properties.length; ++n)
            Array.set(objects, n, deser.fromXML(properties[n]));
       
        return objects;
    }
View Full Code Here

    Map<Object,Object> result = new HashMap<Object,Object>();

    if (xml != null)
    {
      Element[] children = XmlUtils.getAllElements(xml);
      Serializer objectDeserializer = SerializerRegistry.getInstance().getSerializer(Object.class);
 
      for (Element entry : children)
      {
        Element[] keysAndValues = XmlUtils.getAllElements(entry);
        Object key = null;
        Object value = null;
        for (Element element : keysAndValues)
        {
          if (Names.KEY.equals(element.getLocalName()))
          {
            key = _stringSerializer.fromXML(element);
          } else if (Names.VALUE.equals(element.getLocalName()))
          {
            value = objectDeserializer.fromXML(element);
          }
        }
        result.put(key, value);
      }
    }
View Full Code Here

      if (clazz == byte[].class)
      {
        objects[i] = new ByteArraySerializer().fromXML(elements[i]);
      } else
      {
        Serializer ser = registry.getSerializer(parameters[i]);
        objects[i] = ser.fromXML(elements[i]);
      }
    }
    return objects;
  }
View Full Code Here

TOP

Related Classes of org.apache.muse.core.serializer.Serializer

Copyright © 2018 www.massapicom. 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.