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

com.iodesystems.xml.tools.XmlLoaderBuilder Maven / Gradle / Ivy

There is a newer version: 1.0.4
Show newest version
package com.iodesystems.xml.tools;

import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBException;
import org.xml.sax.SAXException;

public class XmlLoaderBuilder {

  private final Map, String> classesBySchemaLocation = new HashMap<>();

  public XmlLoaderBuilder addClasses(String validationLocation, Class cls, Class... clses) {
    addClass(validationLocation, cls);
    for (Class aClass : clses) {
      addClass(validationLocation, aClass);
    }
    return this;
  }

  public XmlLoaderBuilder addClass(Class cls) {
    return addClass(null, cls);
  }

  public XmlLoaderBuilder addClass(String validationLocation, Class cls) {
    classesBySchemaLocation.put(cls, validationLocation);
    return this;
  }

  public XmlLoader build() throws JAXBException, MalformedURLException, SAXException {
    return new XmlLoader(classesBySchemaLocation);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy