001package io.freefair.spring.okhttp.logging;
002
003import okhttp3.logging.HttpLoggingInterceptor;
004import org.springframework.boot.context.properties.ConfigurationProperties;
005
006/**
007 * @author Lars Grefer
008 */
009@ConfigurationProperties(prefix = "okhttp.logging")
010public class OkHttp3LoggingInterceptorProperties {
011    /**
012     * The level at which the HttpLoggingInterceptor logs.
013     */
014    private HttpLoggingInterceptor.Level level = HttpLoggingInterceptor.Level.NONE;
015
016    public OkHttp3LoggingInterceptorProperties() {
017    }
018
019    /**
020     * The level at which the HttpLoggingInterceptor logs.
021     */
022    public HttpLoggingInterceptor.Level getLevel() {
023        return this.level;
024    }
025
026    /**
027     * The level at which the HttpLoggingInterceptor logs.
028     */
029    public void setLevel(final HttpLoggingInterceptor.Level level) {
030        this.level = level;
031    }
032
033    @Override
034    public boolean equals(final Object o) {
035        if (o == this) return true;
036        if (!(o instanceof OkHttp3LoggingInterceptorProperties)) return false;
037        final OkHttp3LoggingInterceptorProperties other = (OkHttp3LoggingInterceptorProperties) o;
038        if (!other.canEqual((Object) this)) return false;
039        final Object this$level = this.getLevel();
040        final Object other$level = other.getLevel();
041        if (this$level == null ? other$level != null : !this$level.equals(other$level)) return false;
042        return true;
043    }
044
045    protected boolean canEqual(final Object other) {
046        return other instanceof OkHttp3LoggingInterceptorProperties;
047    }
048
049    @Override
050    public int hashCode() {
051        final int PRIME = 59;
052        int result = 1;
053        final Object $level = this.getLevel();
054        result = result * PRIME + ($level == null ? 43 : $level.hashCode());
055        return result;
056    }
057
058    @Override
059    public String toString() {
060        return "OkHttp3LoggingInterceptorProperties(level=" + this.getLevel() + ")";
061    }
062}