This commit is contained in:
Keith Donald
2008-07-12 20:19:36 +00:00
parent 6eca56f2a6
commit 1eef8a722d
4 changed files with 23 additions and 2 deletions

View File

@@ -20,6 +20,13 @@ import java.lang.reflect.Array;
import org.springframework.binding.convert.ConversionExecutor;
import org.springframework.binding.convert.ConversionService;
/**
* Special two-way converter that converts an object to an single-element array. Supports type conversion of the
* individual array elements; for example, the ability to convert a String to an Integer[]. Mainly used internally by
* {@link ConversionService} implementations.
*
* @author Keith Donald
*/
public class ObjectToArray implements TwoWayConverter {
private ConversionService conversionService;

View File

@@ -17,10 +17,19 @@ package org.springframework.binding.convert.converters;
import java.beans.PropertyEditor;
/**
* Adapts a PropertyEditor to the {@link TwoWayConverter} interface.
* @author Keith Donald
*/
public class PropertyEditorConverter extends StringToObject {
private PropertyEditor propertyEditor;
/**
* Creates a new property editor converter.
* @param propertyEditor the property editor to adapt
* @param targetClass the {@link PropertyEditor#getValue() value class} this property editor converts to from string
*/
public PropertyEditorConverter(PropertyEditor propertyEditor, Class targetClass) {
super(targetClass);
this.propertyEditor = propertyEditor;

View File

@@ -15,6 +15,13 @@
*/
package org.springframework.binding.convert.converters;
/**
* A converter that calls the {@link TwoWayConverter#convertTargetToSourceClass(Object, Class)} on a target
* {@link TwoWayConverter} instance. Useful for invoking the "reverse" (target-to-source) conversion algorithm using the
* standard Converter contract.
*
* @author Keith Donald
*/
public class ReverseConverter implements Converter {
private TwoWayConverter converter;

View File

@@ -21,7 +21,6 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.binding.convert.ConversionService;
import org.springframework.binding.mapping.Mapper;
import org.springframework.binding.mapping.Mapping;
import org.springframework.binding.mapping.MappingResults;
@@ -31,7 +30,6 @@ import org.springframework.core.style.ToStringCreator;
* Generic mapper implementation that allows mappings to be configured programatically.
*
* @see #addMapping(DefaultMapping)
* @see #setConversionService(ConversionService)
* @author Keith Donald
*/
public class DefaultMapper implements Mapper {