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

com.fasterxml.jackson.jakarta.rs.xml.XMLEndpointConfig Maven / Gradle / Ivy

Go to download

Functionality to handle XML input/output for Jakarta-RS implementations (like Jersey and RESTeasy) using standard Jackson data binding.

The newest version!
package com.fasterxml.jackson.jakarta.rs.xml;

import java.lang.annotation.Annotation;

import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.cfg.MapperConfig;

import com.fasterxml.jackson.jakarta.rs.cfg.EndpointConfigBase;

/**
 * Container class for figuring out annotation-based configuration
 * for Jakarta-RS end points.
 */
public class XMLEndpointConfig
    extends EndpointConfigBase
{
    /*
    /**********************************************************
    /* Construction
    /**********************************************************
     */

    protected XMLEndpointConfig(MapperConfig config) { super(config); }

    public static XMLEndpointConfig forReading(ObjectReader reader,
            Annotation[] annotations)
    {
        return new XMLEndpointConfig(reader.getConfig())
            .add(annotations, false)
            .initReader(reader);
    }

    public static XMLEndpointConfig forWriting(ObjectWriter writer,
            Annotation[] annotations)
    {
        return new XMLEndpointConfig(writer.getConfig())
            .add(annotations, true)
            .initWriter(writer)
        ;
    }

    /*// since 2.6, nothing to add
    @Override
    protected void addAnnotation(Class type,
            Annotation annotation, boolean forWriting)
    {
        super.addAnnotation(type, annotation, forWriting);
    }
    */
    
    @Override
    public Object modifyBeforeWrite(Object value) {
        // nothing to add
        return value;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy