package cn.orm.sqltoy.plus.query;


import cn.orm.sqltoy.plus.AbstractQueryWrapper;
import cn.orm.sqltoy.plus.interfaces.SFunction;
import cn.orm.sqltoy.plus.segments.MergeSegments;
import cn.orm.sqltoy.plus.toolkit.LambdaMeta;
import cn.orm.sqltoy.plus.toolkit.LambdaUtils;
import cn.orm.sqltoy.plus.toolkit.PropertyNamer;

import java.util.concurrent.atomic.AtomicInteger;

public class LambdaQueryWrapper<T> extends AbstractQueryWrapper<T, SFunction<T, ?>, LambdaQueryWrapper<T>> {

    public LambdaQueryWrapper(Class<T> entityClass) {
        this(new MergeSegments(), entityClass);
    }

    protected LambdaQueryWrapper(MergeSegments expression, Class<T> entityClass) {
        super(expression, entityClass);
    }

    protected LambdaQueryWrapper(MergeSegments expression, AtomicInteger paramNameSeq) {
        super(expression, paramNameSeq);
    }

    @Override
    protected LambdaQueryWrapper<T> instance() {
        return new LambdaQueryWrapper<T>(new MergeSegments(), paramNameSeq);
    }

    @Override
    protected String columnToString(SFunction<T, ?> column) {
        return LambdaUtils.extractToFiled(column);
    }
}
