package cn.orm.sqltoy.plus.update;

import cn.orm.sqltoy.plus.AbstractUpdateWrapper;
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 LambdaUpdateWrapper<T> extends AbstractUpdateWrapper<T, SFunction<T, ?>, LambdaUpdateWrapper<T>>{

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

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

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

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

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