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

com.araguacaima.commons.utils.builder.QueryParamSplitter Maven / Gradle / Ivy

package com.araguacaima.commons.utils.builder;

import com.araguacaima.commons.utils.Constants;

public class QueryParamSplitter implements SpecialParamSplitter {

    private final Constants.SpecialQueryParams specialQueryParam = Constants.SpecialQueryParams.QUERY_PARAM;
    private String completeParam;
    private String rightSideParam;
    private String leftSideParam;

    private QueryParamSplitter() {
    }

    public QueryParamSplitter(String queryParamToStore) {
        try {
            completeParam = queryParamToStore;
            String[] tokens = queryParamToStore.split("=");
            leftSideParam = tokens[0];
            rightSideParam = tokens[1];
        } catch (Throwable ignored) {
            throw new IllegalArgumentException("The provided queryParam '" + queryParamToStore + "' is not of a simple query kind");
        }
    }

    @Override
    public Constants.SpecialQueryParams getSpecialQueryParam() {
        return this.specialQueryParam;
    }

    @Override
    public String getCompleteParam() {
        return this.completeParam;
    }

    @Override
    public String getLeftSideParam() {
        return this.leftSideParam;
    }

    @Override
    public String getRightSideParam() {
        return this.rightSideParam;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy