io.tracee.contextlogger.outputgenerator.AbstractContextStringRepresentationBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of contextlogger-core Show documentation
Show all versions of contextlogger-core Show documentation
Please refer to https://github.com/tracee/contextlogger.
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);
}
}