// Path: src/main/java/fr/dudie/nominatim/client/request/paramhelper/ToStringSerializer.java
// public class ToStringSerializer implements QueryParameterSerializer {
// 
//     /**
//      * {@inheritDoc}
//      * 
//      * @see fr.dudie.nominatim.client.request.paramhelper.QueryParameterSerializer#handle(java.lang.Object)
//      */
//     @Override
//     public String handle(final Object value) {
//         if (value instanceof NominatimRequest) {
//             return ((NominatimRequest) value).getQueryString();
//         } else {
//             return value.toString();
//         }
//     }
// }


import fr.dudie.nominatim.client.request.paramhelper.QueryParameter;
import fr.dudie.nominatim.client.request.paramhelper.ToStringSerializer;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
    }

    private static String uriEncode(String paramValue) {
        try {
            return new URI(null, null, null, paramValue, null).getRawQuery();
        } catch (final URISyntaxException e) {
            LOGGER.error("Failure encoding query parameter value {}", new Object[] { paramValue, e });
            return paramValue;
        }
    }

    /**
     * Serializes the field value regardless of reflection errors. Fallback to the {@link ToStringSerializer}.
     * 
     * @param paramMetadata
     *            the query parameter annotation
     * @param fieldValue
     *            the field value
     * @param fieldName
     *            the field name (for logging purposes only)
     * @return the serialized value
     * @throws UnsupportedEncodingException
     *             UTF-8 encoding issue
     */
    private static String serialize(final QueryParameter paramMetadata, final Object fieldValue, final String fieldName) {
        String paramValue;
        try {
            paramValue = paramMetadata.serializer().newInstance().handle(fieldValue);
        } catch (final InstantiationException e) {
            LOGGER.error("Failure while serializing field {}", new Object[] { fieldName, e });
// Path: src/main/java/fr/dudie/nominatim/client/request/paramhelper/ToStringSerializer.java
// public class ToStringSerializer implements QueryParameterSerializer {
// 
//     /**
//      * {@inheritDoc}
//      * 
//      * @see fr.dudie.nominatim.client.request.paramhelper.QueryParameterSerializer#handle(java.lang.Object)
//      */
//     @Override
//     public String handle(final Object value) {
//         if (value instanceof NominatimRequest) {
//             return ((NominatimRequest) value).getQueryString();
//         } else {
//             return value.toString();
//         }
//     }
// }


// Path: src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java
import fr.dudie.nominatim.client.request.paramhelper.QueryParameter;
import fr.dudie.nominatim.client.request.paramhelper.ToStringSerializer;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Locale;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

    }

    private static String uriEncode(String paramValue) {
        try {
            return new URI(null, null, null, paramValue, null).getRawQuery();
        } catch (final URISyntaxException e) {
            LOGGER.error("Failure encoding query parameter value {}", new Object[] { paramValue, e });
            return paramValue;
        }
    }

    /**
     * Serializes the field value regardless of reflection errors. Fallback to the {@link ToStringSerializer}.
     * 
     * @param paramMetadata
     *            the query parameter annotation
     * @param fieldValue
     *            the field value
     * @param fieldName
     *            the field name (for logging purposes only)
     * @return the serialized value
     * @throws UnsupportedEncodingException
     *             UTF-8 encoding issue
     */
    private static String serialize(final QueryParameter paramMetadata, final Object fieldValue, final String fieldName) {
        String paramValue;
        try {
            paramValue = paramMetadata.serializer().newInstance().handle(fieldValue);
        } catch (final InstantiationException e) {
            LOGGER.error("Failure while serializing field {}", new Object[] { fieldName, e });
            paramValue = new ToStringSerializer().handle(fieldValue);