package ru.nbch.credit_tracker.service.xml.jaxb;

import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import org.eclipse.persistence.jaxb.JAXBContextFactory;

import java.nio.charset.Charset;
import java.util.HashMap;

public class XmlProcessorImplAnyClasses extends XmlProcessorImplBase {
    private final JAXBContext context;

    public XmlProcessorImplAnyClasses(Charset charset, Class<?>... classes) throws JAXBException {
        super(charset.name());
        this.context = JAXBContextFactory.createContext(classes, new HashMap<>());
    }

    @Override
    protected JAXBContext getContextByClass(Class<?> clazz) throws JAXBException {
        return context;
    }
}