package org.javaosc.framework.convert;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 
 * @description
 * @author Dylan Tao
 * @date 2014-09-09
 * Copyright 2014 Javaosc Team. All Rights Reserved.
 */
public class IntegerConvert implements Convert<Object, Integer> {

	private static final Logger log = LoggerFactory.getLogger(IntegerConvert.class);

	@Override
	public Integer convert(Object source) {
		if (source == null)
			return null;
		try {
//			if(source instanceof String[]){
//				return Integer.parseInt(String.valueOf(((String[])source)[0]));
//			}else{
				return Integer.parseInt(String.valueOf(source));	
//			}
		} catch (NumberFormatException e) {
			log.warn("IntegerConvert failed, value: {} exception: {}", String.valueOf(source), e);
			return null;
		}
	}

}

@@ -464,128 +464,8 @@
 y %7B%0A
-//%09%09%09if(source instanceof String%5B%5D)%7B%0A//%09%09%09%09return Integer.parseInt(String.valueOf(((String%5B%5D)source)%5B0%5D));%0A//%09%09%09%7Delse%7B%0A%09
 %09%09%09r
@@ -517,15 +517,8 @@
 );%09%0A
-//%09%09%09%7D%0A
 %09%09%7D 

remove Integer convert support