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

com.instaclustr.jackson.JMXServiceURLDeserializer Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
package com.instaclustr.jackson;

import javax.management.remote.JMXServiceURL;
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;

public class JMXServiceURLDeserializer extends StdDeserializer {

    public JMXServiceURLDeserializer() {
        this(null);
    }

    public JMXServiceURLDeserializer(Class vc) {
        super(vc);
    }

    @Override
    public JMXServiceURL deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        if (p.getValueAsString() != null) {
            return new JMXServiceURL(p.getValueAsString());
        } else {
            return null;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy