package me.chyxion.tigon.mybatis;

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

/**
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Feb 21, 2017 17:42:13
 */
public class UpdateXmlProcessor extends AbstractOnMissingCreateProcessor {

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

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