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

org.nuiton.io.rest.DefaultRestClientConfiguration Maven / Gradle / Ivy

The newest version!
/*
 * #%L
 * Maven helper plugin
 * 
 * $Id: DefaultRestClientConfiguration.java 814 2011-05-10 22:07:16Z tchemit $
 * $HeadURL: http://svn.nuiton.org/svn/maven-helper-plugin/tags/maven-helper-plugin-1.3/src/main/java/org/nuiton/io/rest/DefaultRestClientConfiguration.java $
 * %%
 * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public 
 * License along with this program.  If not, see
 * .
 * #L%
 */

package org.nuiton.io.rest;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.net.URL;

/**
 * Default implementation of a {@link RestClientConfiguration}.
 *
 * @author tchemit 
 * @since 1.0.3
 */
public class DefaultRestClientConfiguration implements RestClientConfiguration {

    URL restUrl;

    String restUsername;

    String restPassword;

    boolean verbose;

    boolean anonymous;

    String encoding;

    @Override
    public String getEncoding() {
        return encoding;
    }

    @Override
    public void setEncoding(String encoding) {
        this.encoding = encoding;
    }

    @Override
    public String getRestPassword() {
        return restPassword;
    }

    @Override
    public void setRestPassword(String restPassword) {
        this.restPassword = restPassword;
    }

    @Override
    public URL getRestUrl() {
        return restUrl;
    }

    @Override
    public void setRestUrl(URL restUrl) {
        this.restUrl = restUrl;
    }

    @Override
    public String getRestUsername() {
        return restUsername;
    }

    @Override
    public void setRestUsername(String restUsername) {
        this.restUsername = restUsername;
    }

    @Override
    public boolean isVerbose() {
        return verbose;
    }

    @Override
    public void setVerbose(boolean verbose) {
        this.verbose = verbose;
    }

    public boolean isAnonymous() {
        return anonymous;
    }

    public void setAnonymous(boolean anonymous) {
        this.anonymous = anonymous;
    }

    @Override
    public String toString() {
        ToStringBuilder b = new ToStringBuilder(this,
                                                ToStringStyle.MULTI_LINE_STYLE
        );
        b.append("redmineUrl", restUrl);
        if (anonymous) {

            b.append("anonymous", anonymous);
        } else {
            b.append("redmineUsername", restUsername);
            b.append("redminePassword", "***");
        }
        b.append("encoding", encoding);
        b.append("verbose", verbose);
        return b.toString();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy