All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.what3words.javawrapper.request.ConvertTo3WARequest Maven / Gradle / Ivy

There is a newer version: 3.1.21
Show newest version
package com.what3words.javawrapper.request;

import com.what3words.javawrapper.What3WordsV3;
import com.what3words.javawrapper.response.ConvertTo3WA;

public class ConvertTo3WARequest extends Request {
    private String coordinates;
    private String language;

    private ConvertTo3WARequest(Builder builder) {
        super(builder.api);
        coordinates = builder.coordinates;
        language = builder.language;
    }
    
    private ConvertTo3WA execute() {
        return super.execute(api.what3words().convertTo3wa(coordinates, language), ConvertTo3WA.class);
    }

    public static class Builder extends AbstractBuilder {
        private String coordinates;
        private String language;
        
        public Builder(What3WordsV3 api, Coordinates coordinates) {
            super(api);
            this.coordinates = String.valueOf(coordinates.lat) + "," + String.valueOf(coordinates.lng);
        }
        
        public Builder language(String language) {
            this.language = language;
            return this;
        }
        
        public ConvertTo3WA execute() {
            return new ConvertTo3WARequest(this).execute();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy