package estivate.core.impl;

import java.util.ArrayList;
import java.util.List;

import estivate.core.Converter;

public class DefaultConverter implements Converter {

	public static final List<Converter> convertors = new ArrayList<Converter>();
	static {
		convertors.add(new PrimitiveConverter());
		convertors.add(new StandardConverter());
	}

	public boolean canConvert(Object value, Class<?> targetType) {
		for (Converter typeConverter : convertors) {
			if (typeConverter.canConvert(value, targetType)) {
				return true;
			}
		}
		return false;
	}

	public Object convert(Object value, Class<?> targetType) {
		for (Converter typeConverter : convertors) {
			if (typeConverter.canConvert(value, targetType)) {
				return typeConverter.convert(value, targetType);
			}
		}
		return null;
	}

}

@@ -214,17 +214,17 @@
  convert
-o
+e
 rs = new
@@ -261,33 +261,33 @@
 tic %7B%0D%0A%09%09convert
-o
+e
 rs.add(new Primi
@@ -314,17 +314,17 @@
 %09convert
-o
+e
 rs.add(n
@@ -331,15 +331,13 @@
 ew S
-tandard
+imple
 Conv
@@ -450,33 +450,33 @@
 verter : convert
-o
+e
 rs) %7B%0D%0A%09%09%09if (ty
@@ -674,17 +674,17 @@
  convert
-o
+e
 rs) %7B%0D%0A%09

rename field to converter