// Path: src/main/java/eu/codearte/resteeth/endpoint/EndpointProvider.java
// public interface EndpointProvider {
// 
// 	URL getEndpoint();
// }
// 
// Path: src/main/java/eu/codearte/resteeth/handlers/RestInvocationHandler.java
// public interface RestInvocationHandler extends Ordered {
// 
// 	Object proceed(RestInvocation invocation);
// 
// 	/**
// 	 * Higher priority (smaller value) will cause this handler to be executed earlier in the chain.
// 	 * Low priority (bigger value) will push handler to the end.
// 	 * Handler with lowest priority must handle request.
// 	 *
// 	 * @return Value controlling at what stage this handler will be called.
// 	 * @see org.springframework.core.Ordered
// 	 */
// 	@Override
// 	int getOrder();
// }
// 
// Path: src/main/java/eu/codearte/resteeth/util/SpringUtils.java
// public final class SpringUtils {
// 
// 	private SpringUtils() {
// 	}
// 
// 	public static Collection<RestInvocationHandler> getBeansOfType(Class<RestInvocationHandler> restInvocationHandlerClass,
// 	                                                               ConfigurableListableBeanFactory beanFactory) {
// 		LinkedList<RestInvocationHandler> restInvocationHandlers = new LinkedList<>();
// 		for (String beanName : beanFactory.getBeanDefinitionNames()) {
// 			RootBeanDefinition beanDefinition = (RootBeanDefinition) beanFactory.getMergedBeanDefinition(beanName);
// 
// 			if (restInvocationHandlerClass.isAssignableFrom(beanDefinition.getTargetType())) {
// 				restInvocationHandlers.add((RestInvocationHandler) beanFactory.getBean(beanName));
// 			}
// 		}
// 		return restInvocationHandlers;
// 	}
// 
// 	public static Class getGenericType(Type genericReturnType) {
// 		if (genericReturnType instanceof ParameterizedType) {
// 			return (Class) ((ParameterizedType) genericReturnType).getActualTypeArguments()[0];
// 		} else {
// 			return (Class) genericReturnType;
// 		}
// 	}
// }


import eu.codearte.resteeth.endpoint.EndpointProvider;
import eu.codearte.resteeth.handlers.RestInvocationHandler;
import eu.codearte.resteeth.util.SpringUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.core.Ordered;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.lang.reflect.Field;
import java.util.*;

	private static List<Field> getAllFields(Class<?> type) {
		List<Field> fields = new ArrayList<Field>();
		for (Class<?> c = type; c != null; c = c.getSuperclass()) {
			fields.addAll(Arrays.asList(c.getDeclaredFields()));
		}
		return fields;
	}

	private String appendAnnotatedQueryParameters(String requestUrl, Map<Integer, String> queryParameters, Object[] arguments) {
		return appendQueryParameters(requestUrl, buildArgumentsMap(queryParameters, arguments));
	}

	private String appendQueryParameters(String requestUrl, Map<String, ?> queryParamsMap) {
		if (queryParamsMap.isEmpty()) {
			return requestUrl;
		}

		StringBuilder urlBuilder = new StringBuilder(requestUrl);

		if (urlBuilder.indexOf("?") == -1) {
			urlBuilder.append("?");
		}

		boolean isFirst = true;

		String[] keys = queryParamsMap.keySet().toArray(new String[queryParamsMap.size()]);
		Arrays.sort(keys);
		for (String paramName : keys) {
			if (isFirst) {
// Path: src/main/java/eu/codearte/resteeth/endpoint/EndpointProvider.java
// public interface EndpointProvider {
// 
// 	URL getEndpoint();
// }
// 
// Path: src/main/java/eu/codearte/resteeth/handlers/RestInvocationHandler.java
// public interface RestInvocationHandler extends Ordered {
// 
// 	Object proceed(RestInvocation invocation);
// 
// 	/**
// 	 * Higher priority (smaller value) will cause this handler to be executed earlier in the chain.
// 	 * Low priority (bigger value) will push handler to the end.
// 	 * Handler with lowest priority must handle request.
// 	 *
// 	 * @return Value controlling at what stage this handler will be called.
// 	 * @see org.springframework.core.Ordered
// 	 */
// 	@Override
// 	int getOrder();
// }
// 
// Path: src/main/java/eu/codearte/resteeth/util/SpringUtils.java
// public final class SpringUtils {
// 
// 	private SpringUtils() {
// 	}
// 
// 	public static Collection<RestInvocationHandler> getBeansOfType(Class<RestInvocationHandler> restInvocationHandlerClass,
// 	                                                               ConfigurableListableBeanFactory beanFactory) {
// 		LinkedList<RestInvocationHandler> restInvocationHandlers = new LinkedList<>();
// 		for (String beanName : beanFactory.getBeanDefinitionNames()) {
// 			RootBeanDefinition beanDefinition = (RootBeanDefinition) beanFactory.getMergedBeanDefinition(beanName);
// 
// 			if (restInvocationHandlerClass.isAssignableFrom(beanDefinition.getTargetType())) {
// 				restInvocationHandlers.add((RestInvocationHandler) beanFactory.getBean(beanName));
// 			}
// 		}
// 		return restInvocationHandlers;
// 	}
// 
// 	public static Class getGenericType(Type genericReturnType) {
// 		if (genericReturnType instanceof ParameterizedType) {
// 			return (Class) ((ParameterizedType) genericReturnType).getActualTypeArguments()[0];
// 		} else {
// 			return (Class) genericReturnType;
// 		}
// 	}
// }


// Path: src/main/java/eu/codearte/resteeth/core/RestTemplateInvoker.java
import eu.codearte.resteeth.endpoint.EndpointProvider;
import eu.codearte.resteeth.handlers.RestInvocationHandler;
import eu.codearte.resteeth.util.SpringUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.core.Ordered;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import java.lang.reflect.Field;
import java.util.*;


	private static List<Field> getAllFields(Class<?> type) {
		List<Field> fields = new ArrayList<Field>();
		for (Class<?> c = type; c != null; c = c.getSuperclass()) {
			fields.addAll(Arrays.asList(c.getDeclaredFields()));
		}
		return fields;
	}

	private String appendAnnotatedQueryParameters(String requestUrl, Map<Integer, String> queryParameters, Object[] arguments) {
		return appendQueryParameters(requestUrl, buildArgumentsMap(queryParameters, arguments));
	}

	private String appendQueryParameters(String requestUrl, Map<String, ?> queryParamsMap) {
		if (queryParamsMap.isEmpty()) {
			return requestUrl;
		}

		StringBuilder urlBuilder = new StringBuilder(requestUrl);

		if (urlBuilder.indexOf("?") == -1) {
			urlBuilder.append("?");
		}

		boolean isFirst = true;

		String[] keys = queryParamsMap.keySet().toArray(new String[queryParamsMap.size()]);
		Arrays.sort(keys);
		for (String paramName : keys) {
			if (isFirst) {
				isFirst = false;