All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.schoolwow.quickdao.module.entity.kit.TableDefinerImpl Maven / Gradle / Ivy

There is a newer version: 5.3.1
Show newest version
package cn.schoolwow.quickdao.module.entity.kit;

import cn.schoolwow.quickdao.QuickDAO;
import cn.schoolwow.quickdao.domain.database.ddl.IndexField;
import cn.schoolwow.quickdao.domain.entity.Entity;
import cn.schoolwow.quickdao.domain.entity.Property;

/**
 * 实体类信息定义
 */
public class TableDefinerImpl implements TableDefiner {
    /**
     * 当前实体类
     */
    private Entity entity;

    /**
     * 用于返回QuickDAO对象
     */
    private QuickDAO quickDAO;

    public TableDefinerImpl(Entity entity, QuickDAO quickDAO) {
        this.entity = entity;
        this.quickDAO = quickDAO;
    }

    @Override
    public TableDefiner tableName(String tableName) {
        entity.tableName = tableName;
        return this;
    }

    @Override
    public TableDefiner comment(String comment) {
        entity.comment = comment;
        return this;
    }

    @Override
    public TableDefiner index(IndexField indexField) {
        entity.indexFieldList.add(indexField);
        return this;
    }

    @Override
    public TablePropertyDefiner property(String fieldName) {
        Property property = new Property();
        property.name = fieldName;
        entity.properties.add(property);
        return new TablePropertyDefinerImpl(property, this);
    }

    @Override
    public QuickDAO done() {
        return this.quickDAO;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy