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

com.configcat.FormattableLogMessage Maven / Gradle / Ivy

Go to download

Java SDK for ConfigCat, a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments.

The newest version!
package com.configcat;

import java.util.Arrays;
import java.util.Objects;

class FormattableLogMessage {

    private String cachedMessage;
    protected final String message;
    protected final Object[] args;

    FormattableLogMessage(String message, Object... args) {
        this.message = message;
        this.args = args;
    }

    protected String formatLogMessage(){
        return String.format(message, args);
    }

    @Override
    public String toString() {
        if(cachedMessage == null) {
            cachedMessage = formatLogMessage();
        }
        return cachedMessage;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj instanceof FormattableLogMessage) {
            return toString().equals(obj.toString());
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(cachedMessage, message, Arrays.hashCode(args));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy