org.sonatype.gshell.util.converter.collections
Class MapConverterSupport

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.sonatype.gshell.util.converter.ConverterSupport
          extended by org.sonatype.gshell.util.converter.collections.MapConverterSupport
All Implemented Interfaces:
PropertyEditor, Converter
Direct Known Subclasses:
GenericMapConverter, HashMapConverter, IdentityHashMapConverter, LinkedHashMapConverter, MapConverter, PropertiesConverter, SortedMapConverter, TreeMapConverter, WeakHashMapConverter

public abstract class MapConverterSupport
extends ConverterSupport

Support for Map converters.

Since:
2.0

Constructor Summary
  MapConverterSupport(Class type)
           
protected MapConverterSupport(Class type, PropertyEditor keyEditor, PropertyEditor valueEditor)
           
 
Method Summary
protected  Object convertToObject(String text)
          Treats the text value of this property as an input stream that is converted into a Property bundle.
protected  String convertToString(Object value)
          Converts the supplied object to text.
protected abstract  Map createMap(Map map)
           
 
Methods inherited from class org.sonatype.gshell.util.converter.ConverterSupport
getAsText, getType, getValue, setAsText, setValue, toObject, toString
 
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, isPaintable, paintValue, removePropertyChangeListener, setSource, supportsCustomEditor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.beans.PropertyEditor
addPropertyChangeListener, getCustomEditor, getJavaInitializationString, getTags, isPaintable, paintValue, removePropertyChangeListener, supportsCustomEditor
 

Constructor Detail

MapConverterSupport

public MapConverterSupport(Class type)

MapConverterSupport

protected MapConverterSupport(Class type,
                              PropertyEditor keyEditor,
                              PropertyEditor valueEditor)
Method Detail

convertToObject

protected final Object convertToObject(String text)
                                throws Exception
Treats the text value of this property as an input stream that is converted into a Property bundle.

Specified by:
convertToObject in class ConverterSupport
Parameters:
text - The text to convertToObject
Returns:
a Properties object
Throws:
ConversionException - An error occurred creating the Properties object.
Exception - Conversion failed

createMap

protected abstract Map createMap(Map map)
                          throws Exception
Throws:
Exception

convertToString

protected final String convertToString(Object value)
Description copied from class: ConverterSupport
Converts the supplied object to text. The supplied object will always be an instance of the editor type, and specifically will never be null or a String (unless this is the String editor).

Overrides:
convertToString in class ConverterSupport
Parameters:
value - an instance of the editor type
Returns:
the text equivalent of the value


Copyright © 2008-2011 Sonatype. All Rights Reserved.