
package io.coala.config;

import java.lang.reflect.Method;

import org.aeonbits.owner.Converter;

import io.coala.json.JsonUtil;

/**
 * {@link JsonConverter} is a JSON-string {@link Converter} to the expected type
 * 
 * @version $Id: f72f19c87e997baef47903c8d71facb597eea58b $
 * @author Rick van Krevelen
 */
public class JsonConverter implements Converter<Object>
{
//	@SuppressWarnings( "unchecked" )
	@Override
	public Object convert( final Method method, final String input )
	{
//		final Class<?> returnType = (Class<T>) TypeArguments
//				.of( JsonConverter.class, getClass() ).get( 0 );
//		Objects.requireNonNull( returnType );
		return JsonUtil.valueOf( /* "\"" + */ input /* + "\"" */,
				method.getReturnType() );
	}
}
