📄 entityfieldmodelbean.java
字号:
package com.cownew.studio.modelDev.common;
import java.beans.PropertyChangeSupport;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.ui.views.properties.IPropertySource;
import com.cownew.studio.modelDev.common.enumdef.CascadeEnum;
import com.cownew.studio.modelDev.common.enumdef.DataTypeEnum;
import com.cownew.studio.modelDev.common.enumdef.LinkTypeEnum;
import com.cownew.studio.modelDev.common.enumdef.OuterJoinEnum;
import com.cownew.studio.modelDev.propertiesSheet.EntityFieldPropertySource;
public class EntityFieldModelBean implements IAdaptable
{
// 字段名
private String name;
// 字段别名
private String alias;
// 字段类型
private DataTypeEnum dataType;
// 字段对应的数据库字段名
private String dbFieldName;
// 是否允许为空
private boolean allowNull;
// 长度
private int length;
// 是否是关联其他实体的属性
private boolean isLinkProperty;
// 关联类型
private LinkTypeEnum linkType;
// 被关联实体的路径
private String linkEntity;
// 级联取值类型
private CascadeEnum cascadeType;
// 外连接类型
private OuterJoinEnum outerJoinType;
// 是否外键约束
private boolean constrained;
// 是否反向关联
private boolean inverse;
// 关联字段名
private String keyColumn;
private IPropertySource propSouce;
private PropertyChangeSupport propChangeSupport;
public EntityFieldModelBean(IProject project)
{
super();
dataType = DataTypeEnum.STRING;
propSouce = new EntityFieldPropertySource(this, project);
propChangeSupport = new PropertyChangeSupport(this);
}
public String getAlias()
{
return CommonUtils.emptyIfNull(alias);
}
public void setAlias(String alias)
{
Object oldValue = this.alias;
this.alias = alias;
propChangeSupport.firePropertyChange("alias", oldValue, alias);
}
public String getDbFieldName()
{
return CommonUtils.emptyIfNull(dbFieldName);
}
public void setDbFieldName(String dbFieldName)
{
Object oldValue = this.dbFieldName;
this.dbFieldName = dbFieldName;
propChangeSupport.firePropertyChange("dbFieldName", oldValue,
dbFieldName);
}
public String getName()
{
return CommonUtils.emptyIfNull(name);
}
public void setName(String name)
{
Object oldValue = this.name;
this.name = name;
propChangeSupport.firePropertyChange("name", oldValue, name);
}
public DataTypeEnum getDataype()
{
return dataType;
}
public void setDataType(DataTypeEnum dataType)
{
Object oldValue = this.dataType;
this.dataType = dataType;
propChangeSupport.firePropertyChange("name", oldValue, dataType);
}
public String getLinkEntity()
{
return CommonUtils.emptyIfNull(linkEntity);
}
public void setLinkEntity(String linkEntity)
{
Object oldValue = this.linkEntity;
this.linkEntity = linkEntity;
propChangeSupport
.firePropertyChange("linkEntity", oldValue, linkEntity);
}
public boolean isAllowNull()
{
return allowNull;
}
public void setAllowNull(boolean allowNull)
{
Object oldValue = this.allowNull;
this.allowNull = allowNull;
propChangeSupport.firePropertyChange("allowNull", oldValue, allowNull);
}
public boolean isLinkProperty()
{
return isLinkProperty;
}
public void setLinkProperty(boolean isLinkProperty)
{
Object oldValue = this.isLinkProperty;
this.isLinkProperty = isLinkProperty;
propChangeSupport.firePropertyChange("isLinkProperty", oldValue,
isLinkProperty);
}
public int getLength()
{
return length;
}
public void setLength(int length)
{
Object oldValue = this.length;
this.length = length;
propChangeSupport.firePropertyChange("length", oldValue, length);
}
public LinkTypeEnum getLinkType()
{
return linkType;
}
public void setLinkType(LinkTypeEnum linkType)
{
Object oldValue = this.linkType;
this.linkType = linkType;
propChangeSupport.firePropertyChange("linkType", oldValue, linkType);
}
public CascadeEnum getCascadeType()
{
if (cascadeType == null)
{
return CascadeEnum.none;
}
return cascadeType;
}
public void setCascadeType(CascadeEnum cascadeType)
{
Object oldValue = this.cascadeType;
this.cascadeType = cascadeType;
propChangeSupport.firePropertyChange("cascadeType", oldValue,
cascadeType);
}
public boolean isConstrained()
{
return constrained;
}
public void setConstrained(boolean constrained)
{
Object oldValue = this.constrained;
this.constrained = constrained;
propChangeSupport.firePropertyChange("constrained", oldValue,
constrained);
}
public OuterJoinEnum getOuterJoinType()
{
return outerJoinType;
}
public void setOuterJoinType(OuterJoinEnum outerJoinType)
{
Object oldValue = this.outerJoinType;
this.outerJoinType = outerJoinType;
propChangeSupport.firePropertyChange("outerJoinType", oldValue,
outerJoinType);
}
public DataTypeEnum getDataType()
{
return dataType;
}
public boolean isInverse()
{
return inverse;
}
public void setInverse(boolean inverse)
{
Object oldValue = this.inverse;
this.inverse = inverse;
propChangeSupport.firePropertyChange("inverse", oldValue, inverse);
}
public String getKeyColumn()
{
return CommonUtils.emptyIfNull(keyColumn);
}
public void setKeyColumn(String keyColumn)
{
Object oldValue = this.keyColumn;
this.keyColumn = keyColumn;
propChangeSupport.firePropertyChange("keyColumn", oldValue, keyColumn);
}
public Object getAdapter(Class adapter)
{
if (adapter.equals(IPropertySource.class))
{
return propSouce;
}
if (adapter.equals(PropertyChangeSupport.class))
{
return propChangeSupport;
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -