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

io.tracee.contextlogger.outputgenerator.AbstractContextStringRepresentationBuilder Maven / Gradle / Ivy

There is a newer version: 0.11.0
Show newest version
package io.tracee.contextlogger.outputgenerator;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import io.tracee.contextlogger.api.TraceeContextStringRepresentationBuilder;
import io.tracee.contextlogger.outputgenerator.writer.BasicOutputWriterConfiguration;
import io.tracee.contextlogger.outputgenerator.writer.OutputWriterConfiguration;
import io.tracee.contextlogger.profile.Profile;

/**
 * Abstract base class for all context toJson builder implementations.
 * Created by Tobias Gindler, holisticon AG on 20.03.14.
 */
public abstract class AbstractContextStringRepresentationBuilder implements TraceeContextStringRepresentationBuilder {

    private Set wrapperClasses;
    private Profile profile;
    private Map manualContextOverrides;
    private boolean keepOrder;
    private OutputWriterConfiguration outputWriterConfiguration;

    @Override
    public final Set getWrapperClasses() {
        return wrapperClasses;
    }

    @Override
    public final void setWrapperClasses(Set wrapperClasses) {
        this.wrapperClasses = wrapperClasses;
    }

    public final void setProfile(final Profile profile) {
        this.profile = profile;
    }

    public final Profile getProfile() {
        return this.profile;
    }

    public final void setManualContextOverrides(final Map manualContextOverrides) {
        this.manualContextOverrides = manualContextOverrides;
    }

    public final Map getManualContextOverrides() {
        return manualContextOverrides != null ? manualContextOverrides : new HashMap();
    }

    public final boolean getEnforceOrder() {
        return keepOrder;
    }

    public final void setEnforceOrder(final boolean keepOrder) {
        this.keepOrder = keepOrder;
    }

    public OutputWriterConfiguration getOutputWriterConfiguration() {
        return outputWriterConfiguration != null ? outputWriterConfiguration : BasicOutputWriterConfiguration.JSON_INTENDED;
    }

    public final void setOutputWriterConfiguration(final OutputWriterConfiguration outputWriterConfiguration) {
        this.outputWriterConfiguration = outputWriterConfiguration;
    }

    protected void cloneTo(AbstractContextStringRepresentationBuilder cloneTo) {

        cloneTo.setWrapperClasses(new HashSet(wrapperClasses));
        cloneTo.setProfile(profile);
        cloneTo.setManualContextOverrides(manualContextOverrides);
        cloneTo.setEnforceOrder(keepOrder);
        cloneTo.setOutputWriterConfiguration(outputWriterConfiguration);

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy