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

com.internetitem.logback.elasticsearch.util.AbstractPropertyAndEncoder Maven / Gradle / Ivy

package com.internetitem.logback.elasticsearch.util;

import ch.qos.logback.core.Context;
import ch.qos.logback.core.pattern.PatternLayoutBase;
import com.internetitem.logback.elasticsearch.config.Property;

public abstract class AbstractPropertyAndEncoder {
	private Property property;
	private PatternLayoutBase layout;

	public AbstractPropertyAndEncoder(Property property, Context context) {
		this.property = property;

		this.layout = getLayout();
		this.layout.setContext(context);
		this.layout.setPattern(property.getValue());
		this.layout.setPostCompileProcessor(null);
		this.layout.start();
	}

	protected abstract PatternLayoutBase getLayout();

	public String encode(T event) {
		return layout.doLayout(event);
	}

	public String getName() {
		return property.getName();
	}

	public boolean allowEmpty() {
		return property.isAllowEmpty();
	}

	public Property.Type getType() {
		return property.getType();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy