org.apache.shindig.protocol.conversion.xstream
Class MapConverter

java.lang.Object
  extended by com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
      extended by org.apache.shindig.protocol.conversion.xstream.MapConverter
All Implemented Interfaces:
com.thoughtworks.xstream.converters.Converter, com.thoughtworks.xstream.converters.ConverterMatcher

public class MapConverter
extends com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter

converts a map to and from the form <container> <key>value</key> <key>value</key> .


Constructor Summary
MapConverter(com.thoughtworks.xstream.mapper.Mapper mapper)
          Create a MapConverter that use use the supplied mapper.
 
Method Summary
 boolean canConvert(Class clazz)
          Can this Converter convert the type supplied.
 void marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
          output the Map in the simplified form.
 Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
          Convert a suitably positioned reader stream into a Map object.
 
Methods inherited from class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
createCollection, mapper, readItem, writeItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapConverter

public MapConverter(com.thoughtworks.xstream.mapper.Mapper mapper)
Create a MapConverter that use use the supplied mapper.

Parameters:
mapper - the mapped to base the conversion on.
Method Detail

marshal

public void marshal(Object source,
                    com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
                    com.thoughtworks.xstream.converters.MarshallingContext context)
output the Map in the simplified form.

Specified by:
marshal in interface com.thoughtworks.xstream.converters.Converter
Specified by:
marshal in class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
Parameters:
source - the object to be output
writer - the writer to use to perform the output.
context - the context in which to perform the output.
See Also:
Converter.marshal(java.lang.Object, com.thoughtworks.xstream.io.HierarchicalStreamWriter, com.thoughtworks.xstream.converters.MarshallingContext)

unmarshal

public Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
                        com.thoughtworks.xstream.converters.UnmarshallingContext context)
Convert a suitably positioned reader stream into a Map object.

Specified by:
unmarshal in interface com.thoughtworks.xstream.converters.Converter
Specified by:
unmarshal in class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
Parameters:
reader - the stream reader positioned at the start of the object.
context - the unmarshalling context.
Returns:
the object representing the stream.
See Also:
Converter.unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader, com.thoughtworks.xstream.converters.UnmarshallingContext)

canConvert

public boolean canConvert(Class clazz)
Can this Converter convert the type supplied.

Specified by:
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcher
Specified by:
canConvert in class com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter
Parameters:
clazz - the type being converted.
Returns:
true if the type supplied is a form of Map.
See Also:
ConverterMatcher.canConvert(java.lang.Class)


Copyright © 2007-2012. All Rights Reserved.