com.testdroid.api.serialization.level.Log4jLevelDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testdroid-api Show documentation
Show all versions of testdroid-api Show documentation
The Testdroid API library for Java
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);
}
}