org.sonatype.gshell.util.converter.basic
Class EnumConverter

java.lang.Object
  extended by java.beans.PropertyEditorSupport
      extended by org.sonatype.gshell.util.converter.ConverterSupport
          extended by org.sonatype.gshell.util.converter.basic.EnumConverter
All Implemented Interfaces:
PropertyEditor, Converter

public class EnumConverter
extends ConverterSupport

Converter for Enum types.

Since:
2.0

Constructor Summary
EnumConverter(Class type)
           
 
Method Summary
protected  Object convertToObject(String text)
          Converts the supplied text in to an instance of the editor type.
 
Methods inherited from class org.sonatype.gshell.util.converter.ConverterSupport
convertToString, 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

EnumConverter

public EnumConverter(Class type)
Method Detail

convertToObject

protected Object convertToObject(String text)
                          throws Exception
Description copied from class: ConverterSupport
Converts the supplied text in to an instance of the editor type. The text will never be null, and trim() will already have been called.

Specified by:
convertToObject in class ConverterSupport
Parameters:
text - The text to convertToObject
Returns:
An instance of the converted type
Throws:
Exception - Conversion failed


Copyright © 2008-2011 Sonatype. All Rights Reserved.