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

com.testdroid.api.serialization.level.Log4jLevelDeserializer Maven / Gradle / Ivy

There is a newer version: 3.34.0
Show newest version
package com.testdroid.api.serialization.level;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import org.apache.logging.log4j.Level;

import java.io.IOException;

/**
 * @author Artur Ćwikliński 
 */
public class Log4jLevelDeserializer extends StdDeserializer {

    protected Log4jLevelDeserializer(Class vc) {
        super(vc);
    }

    @Override
    public Level deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
            throws IOException {
        String name = jsonParser.getText();
        return Level.getLevel(name);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy