package me.chyxion.tigon.mybatis;

import java.util.Iterator;

/**
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * 2017/1/23 17:04
 */
class BetweenSearchProcessor extends AbstractSearchProcessor {

    /**
     * {@inheritDoc}
     */
    @Override
    CriterionType type() {
        return CriterionType.BETWEEN;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    void doProcess(SearchProcessArgs args) {
        Iterator<?> valuesIt = args.getCriterion().getValues().iterator();
        args.append(args.getCol() + " between ")
            .addValue(valuesIt.next()).append(" and ")
            .addValue(valuesIt.next());
    }
}
