Package org.apache.xbean.propertyeditor
Class AbstractConverter
java.lang.Object
java.beans.PropertyEditorSupport
org.apache.xbean.propertyeditor.AbstractConverter
- All Implemented Interfaces:
PropertyEditor
,Converter
- Direct Known Subclasses:
AbstractCollectionConverter
,AbstractMapConverter
,BigDecimalEditor
,BigIntegerEditor
,BooleanEditor
,ByteEditor
,CharacterEditor
,ClassEditor
,CommonsLoggingConverter
,DateEditor
,DoubleEditor
,EnumConverter
,FileEditor
,FloatEditor
,Inet4AddressEditor
,Inet6AddressEditor
,InetAddressEditor
,IntegerEditor
,JndiConverter
,Log4jConverter
,LoggerConverter
,LongEditor
,ObjectNameEditor
,PatternConverter
,ShortEditor
,StringEditor
,URIEditor
,URLEditor
A base class for converters. This class handles all converter methods, and redirects all conversion requests to
toStringImpl and toObjectImpl. These methods can assume that the supplied value or text is never null, and that
type checking has been applied to the value.
- Version:
- $Rev: 6680 $
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractConverter
(Class type) Creates an abstract converter for the specified type.protected
AbstractConverter
(Class type, boolean trim) -
Method Summary
Modifier and TypeMethodDescriptionfinal String
final Class
getType()
Gets the the type of object supported by this converter.final Object
getValue()
final void
final void
final Object
Converts the supplied text in to an instance of the editor type.protected abstract Object
toObjectImpl
(String text) Converts the supplied text in to an instance of the editor type.final String
Converts the supplied object to text.protected String
toStringImpl
(Object value) Converts the supplied object to text.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 Details
-
AbstractConverter
Creates an abstract converter for the specified type.- Parameters:
type
- type of the property editor
-
AbstractConverter
-
-
Method Details
-
getType
Description copied from interface:Converter
Gets the the type of object supported by this converter. -
getAsText
- Specified by:
getAsText
in interfacePropertyEditor
- Overrides:
getAsText
in classPropertyEditorSupport
-
setAsText
- Specified by:
setAsText
in interfacePropertyEditor
- Overrides:
setAsText
in classPropertyEditorSupport
-
getValue
- Specified by:
getValue
in interfacePropertyEditor
- Overrides:
getValue
in classPropertyEditorSupport
-
setValue
- Specified by:
setValue
in interfacePropertyEditor
- Overrides:
setValue
in classPropertyEditorSupport
-
toString
Description copied from interface:Converter
Converts the supplied object to text. If value is null, null will be returned. If value is not an instance of the this converter's type, a PropertyEditorException will be thrown. -
toObject
Description copied from interface:Converter
Converts the supplied text in to an instance of the editor type. If text is null, null will be returned. -
toStringImpl
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).- Parameters:
value
- an instance of the editor type- Returns:
- the text equivalent of the value
-
toObjectImpl
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.- Parameters:
text
- the text to convert- Returns:
- an instance of the editor type
-