com.ktanx.autocoder.config.ColumnMetaData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ktanx-autocoder Show documentation
Show all versions of ktanx-autocoder Show documentation
ktanx-autocoder is a java code generate kit.
The newest version!
package com.ktanx.autocoder.config;
import com.ktanx.common.utils.NameUtils;
import lombok.Builder;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
/**
* 列信息
*/
@Getter
@Builder
public class ColumnMetaData {
/**
* 列名
*/
private String name;
/**
* 是否主键
*/
private Boolean isPk;
/**
* 是否自增
*/
private Boolean isAutoIncrement;
/**
* 是否允许为空
*/
private Boolean isNullable;
/**
* 字段长度
*/
private int displaySize;
/**
* 精度
*/
private int scale;
/**
* 列备注
*/
private String comment;
/**
* 数据库类型
*/
private String dbType;
/**
* jdbc类型
*/
private String jdbcType;
/**
* java类型 例:java.lang.String
*/
private String javaType;
/**
* 明确定义java类型
*
* @param javaType
*/
public void defineJavaType(String javaType) {
this.javaType = javaType;
}
/**
* 获取骆驼命名法的列名称
*
* @return
*/
public String getCamelName() {
return NameUtils.getCamelName(this.name);
}
/**
* 获取首字母大写名称
*
* @return
*/
public String getFirstUpperCamelName() {
return NameUtils.getFirstUpperName(this.getCamelName());
}
/**
* 获取短的java类型,即不含包名
*
* @return
*/
public String getShortJavaType() {
int index = StringUtils.lastIndexOf(this.javaType, ".");
return StringUtils.substring(this.javaType, index + 1);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy