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

net.thisptr.java.prometheus.metrics.agent.jackson.serdes.AttributeNamePatternDeserializer Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package net.thisptr.java.prometheus.metrics.agent.jackson.serdes;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

import net.thisptr.java.prometheus.metrics.agent.misc.AttributeNamePattern;

public class AttributeNamePatternDeserializer extends StdDeserializer {
	private static final long serialVersionUID = 503000533123157062L;

	public AttributeNamePatternDeserializer() {
		super(AttributeNamePattern.class);
	}

	@Override
	public AttributeNamePattern deserialize(final JsonParser p, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
		final String patternText = p.readValueAs(String.class);
		if (patternText == null)
			return null;
		return AttributeNamePattern.compile(patternText);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy