org.zodiac.fastorm.rdb.metadata.ConstraintMetadata Maven / Gradle / Ivy
The newest version!
package org.zodiac.fastorm.rdb.metadata;
import org.zodiac.fastorm.core.meta.ObjectMetadata;
import org.zodiac.sdk.toolkit.util.ExceptionUtil;
import java.util.Objects;
import java.util.Set;
public class ConstraintMetadata implements ObjectMetadata {
private String name;
private String alias;
private String tableName;
private Set columns;
private ConstraintType type;
public ConstraintMetadata() {
super();
}
public String getName() {
return name;
}
public ConstraintMetadata setName(String name) {
this.name = name;
return this;
}
public String getAlias() {
return alias;
}
public ConstraintMetadata setAlias(String alias) {
this.alias = alias;
return this;
}
public String getTableName() {
return tableName;
}
public ConstraintMetadata setTableName(String tableName) {
this.tableName = tableName;
return this;
}
public Set getColumns() {
return columns;
}
public ConstraintMetadata setColumns(Set columns) {
this.columns = columns;
return this;
}
public ConstraintType getType() {
return type;
}
public ConstraintMetadata setType(ConstraintType type) {
this.type = type;
return this;
}
@Override
public RDBObjectType getObjectType() {
return RDBObjectType.constraint;
}
@Override
public ObjectMetadata clone() {
ObjectMetadata clone = null;
try {
clone = (ConstraintMetadata) super.clone();
} catch (Exception e) {
ExceptionUtil.chuck(e);
}
return clone;
}
@Override
public int hashCode() {
return Objects.hash(alias, columns, name, tableName, type);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ConstraintMetadata other = (ConstraintMetadata)obj;
return Objects.equals(alias, other.alias) && Objects.equals(columns, other.columns)
&& Objects.equals(name, other.name) && Objects.equals(tableName, other.tableName) && type == other.type;
}
@Override
public String toString() {
return "[name=" + name + ", alias=" + alias + ", tableName=" + tableName + ", columns="
+ columns + ", type=" + type + "]";
}
}