class DefaultSettingsXmlFactory implements SettingsXmlFactory {
    @Override
    public Settings read(@Nonnull XmlReaderRequest request) throws XmlReaderException {
        nonNull(request, "request");
        Reader reader = request.getReader();
        InputStream inputStream = request.getInputStream();
        if (reader == null && inputStream == null) {
            throw new IllegalArgumentException("reader or inputStream must be non null");
        }
        try {
            InputSource source = null;
            if (request.getModelId() != null || request.getLocation() != null) {
                source = new InputSource(request.getLocation());
            }
            SettingsStaxReader xml = new SettingsStaxReader();
            xml.setAddDefaultEntities(request.isAddDefaultEntities());
            if (reader != null) {
                return xml.read(reader, request.isStrict(), source);
            } else {
                return xml.read(inputStream, request.isStrict(), source);
            }
        } catch (Exception e) {
            throw new XmlReaderException("Unable to read settings: " + getMessage(e), getLocation(e), e);
        }
    }

    @Override
    public void write(XmlWriterRequest<Settings> request) throws XmlWriterException {<FILL_FUNCTION_BODY>}

    static <T> T nonNull(T t, String name) {
        if (t == null) {
            throw new IllegalArgumentException(name + " cannot be null");
        }
        return t;
    }
}

        nonNull(request, "request");
        Settings content = nonNull(request.getContent(), "content");
        OutputStream outputStream = request.getOutputStream();
        Writer writer = request.getWriter();
        if (writer == null && outputStream == null) {
            throw new IllegalArgumentException("writer or outputStream must be non null");
        }
        try {
            if (writer != null) {
                new SettingsStaxWriter().write(writer, content);
            } else {
                new SettingsStaxWriter().write(outputStream, content);
            }
        } catch (Exception e) {
            throw new XmlWriterException("Unable to write settings: " + getMessage(e), getLocation(e), e);
        }
    
<no_super_class>