com.pepaproch.gtswsdlclient.impl.AvailabilityCheckQueryBuilderImpl.java Source code

Java tutorial

Introduction

Here is the source code for com.pepaproch.gtswsdlclient.impl.AvailabilityCheckQueryBuilderImpl.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.pepaproch.gtswsdlclient.impl;

import com.pepaproch.gtswsdl.QueryBuilder;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;

/**
 *
 * @author pepa
 */
public class AvailabilityCheckQueryBuilderImpl implements QueryBuilder<String> {

    private final String url;

    public AvailabilityCheckQueryBuilderImpl(String url) {
        this.url = url;

    }

    @Override
    public UriComponents buildQuery(String addrId) {
        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
        if (addrId != null && !addrId.isEmpty()) {
            builder.queryParam("uirAdr", addrId);
        }

        return builder.build();
    }

}