package me.chyxion.tigon.mybatis;

import org.w3c.dom.Element;
import org.w3c.dom.Document;

/**
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Feb 22, 2017 11:56:43
 */
public class SetNullXmlProcessor extends AbstractOnMissingCreateProcessor {

    /**
     * {@inheritDoc}
     */
    @Override
    protected String missingXPathExpression() {
        return "/mapper/update[@id='setNull']";
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected Element elementToAppend(Class<BaseMapper<?, ?>> mapperClass, Document doc) {
        Element setNullEl = doc.createElement("update");
        setNullEl.setAttribute("id", "setNull");
        return appendIncludeEl(doc, setNullEl, "Tigon.setNull");
    }
}
