com.iodesystems.xml.tools.XmlLoaderBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xmltools Show documentation
Show all versions of xmltools Show documentation
Xmltools contains a flexible jaxb xml loader
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