#2359 - Rename internal methods - BeanDescriptor

This commit is contained in:
rbygrave committed 2021-09-08 15:17:17 +12:00
1 parent d582e63c25
commit d389ac680f
129 files changed
+552 -555

No files matched your search

@@ -90,10 +90,10 @@ public class MTable {
public MTable(BeanDescriptor<?> descriptor) {
this.name = descriptor.baseTable();
this.identityMode = descriptor.getIdentityMode();
this.storageEngine = descriptor.getStorageEngine();
this.partitionMeta = descriptor.getPartitionMeta();
this.comment = descriptor.getDbComment();
this.identityMode = descriptor.identityMode();
this.storageEngine = descriptor.storageEngine();
this.partitionMeta = descriptor.partitionMeta();
this.comment = descriptor.dbComment();
if (descriptor.isHistorySupport()) {
withHistory = true;
BeanProperty whenCreated = descriptor.whenCreatedProperty();
@@ -36,7 +36,7 @@ public class ModelBuildBeanVisitor implements BeanVisitor {
// add the table to the model
ctx.addTable(table);
InheritInfo inheritInfo = descriptor.getInheritInfo();
InheritInfo inheritInfo = descriptor.inheritInfo();
if (inheritInfo != null && inheritInfo.isRoot()) {
// add the discriminator column
String discColumn = inheritInfo.getDiscriminatorColumn();
@@ -153,7 +153,7 @@ public class ModelBuildContext {
private DbPlatformType getDbType(BeanProperty p) {
if (p.isDbEncrypted()) {
return dbTypeMap.get(p.getDbEncryptedType());
return dbTypeMap.get(p.dbEncryptedType());
}
if (p.isLocalEncrypted()) {
// scalar type potentially wrapping varbinary db type
@@ -163,7 +163,7 @@ public class ModelBuildContext {
}
// can be the logical JSON types (JSON, JSONB, JSONClob, JSONBlob, JSONVarchar)
int dbType = p.getDbType(platformTypes);
int dbType = p.dbType(platformTypes);
if (dbType == 0) {
throw new RuntimeException("No scalarType defined for " + p.fullName());
}
@@ -16,8 +16,8 @@ public class ModelBuildElementTable {
*/
public static void build(ModelBuildContext ctx, BeanPropertyAssocMany<?> manyProp) {
BeanTable beanTable = manyProp.getBeanTable();
BeanDescriptor<?> targetDescriptor = manyProp.getTargetDescriptor();
BeanTable beanTable = manyProp.beanTable();
BeanDescriptor<?> targetDescriptor = manyProp.targetDescriptor();
MTable table = new MTable(beanTable.getBaseTable());
VisitProperties.visit(targetDescriptor, new ModelBuildPropertyVisitor(ctx, table, targetDescriptor));
@@ -24,8 +24,8 @@ class ModelBuildIntersectionTable {
ModelBuildIntersectionTable(ModelBuildContext ctx, BeanPropertyAssocMany<?> manyProp) {
this.ctx = ctx;
this.manyProp = manyProp;
this.intersectionTableJoin = manyProp.getIntersectionTableJoin();
this.tableJoin = manyProp.getTableJoin();
this.intersectionTableJoin = manyProp.intersectionTableJoin();
this.tableJoin = manyProp.tableJoin();
}
public MTable build() {
@@ -39,7 +39,7 @@ class ModelBuildIntersectionTable {
buildFkConstraints();
if (manyProp.getTargetDescriptor().isDraftable()) {
if (manyProp.targetDescriptor().isDraftable()) {
ctx.createDraft(intersectionTable, false);
}
@@ -50,16 +50,16 @@ class ModelBuildIntersectionTable {
if (manyProp.hasForeignKeyConstraint()) {
ctx.fkeyBuilder(intersectionTable)
.addForeignKey(manyProp.getBeanDescriptor(), intersectionTableJoin, true)
.addForeignKey(manyProp.getTargetDescriptor(), tableJoin, false);
.addForeignKey(manyProp.descriptor(), intersectionTableJoin, true)
.addForeignKey(manyProp.targetDescriptor(), tableJoin, false);
}
intersectionTable.checkDuplicateForeignKeys();
}
private MTable createTable() {
BeanDescriptor<?> localDesc = manyProp.getBeanDescriptor();
BeanDescriptor<?> targetDesc = manyProp.getTargetDescriptor();
BeanDescriptor<?> localDesc = manyProp.descriptor();
BeanDescriptor<?> targetDesc = manyProp.targetDescriptor();
String tableName = intersectionTableJoin.getTable();
MTable table = new MTable(tableName);
@@ -85,7 +85,7 @@ class ModelBuildIntersectionTable {
private void addColumn(MTable table, BeanDescriptor<?> desc, String column, String findPropColumn) {
BeanProperty p = desc.getIdBinder().findBeanProperty(findPropColumn);
BeanProperty p = desc.idBinder().findBeanProperty(findPropColumn);
if (p == null) {
throw new RuntimeException("Could not find id property for " + findPropColumn);
}
@@ -50,7 +50,7 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
this.ctx = ctx;
this.table = table;
this.beanDescriptor = beanDescriptor;
addIndexes(beanDescriptor.getIndexDefinitions());
addIndexes(beanDescriptor.indexDefinitions());
}
/**
@@ -187,19 +187,19 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
@Override
public void visitOneImported(BeanPropertyAssocOne<?> p) {
TableJoinColumn[] columns = p.getTableJoin().columns();
TableJoinColumn[] columns = p.tableJoin().columns();
if (columns.length == 0) {
throw new RuntimeException("No join columns for " + p.fullName());
}
ImportedId importedId = p.getImportedId();
ImportedId importedId = p.importedId();
List<MColumn> modelColumns = new ArrayList<>(columns.length);
MCompoundForeignKey compoundKey = null;
if (columns.length > 1) {
// compound foreign key
String refTable = p.getTargetDescriptor().baseTable();
String refTable = p.targetDescriptor().baseTable();
String fkName = foreignKeyConstraintName(p.name());
String fkIndex = foreignKeyIndexName(p.name());
compoundKey = new MCompoundForeignKey(fkName, refTable, fkIndex);
@@ -217,22 +217,22 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
String refColumn = importedProperty.dbColumn();
MColumn col = table.addColumn(dbCol, columnDefn, !p.isNullable());
col.setDbMigrationInfos(p.getDbMigrationInfos());
col.setDefaultValue(p.getDbColumnDefault());
col.setDbMigrationInfos(p.dbMigrationInfos());
col.setDefaultValue(p.dbColumnDefault());
if (columns.length == 1) {
if (p.hasForeignKeyConstraint() && !importedProperty.getBeanDescriptor().suppressForeignKey()) {
if (p.hasForeignKeyConstraint() && !importedProperty.descriptor().suppressForeignKey()) {
// single references column (put it on the column)
String refTable = importedProperty.getBeanDescriptor().getBaseTable();
String refTable = importedProperty.descriptor().getBaseTable();
if (refTable == null) {
// odd case where an EmbeddedId only has 1 property
refTable = p.getTargetDescriptor().getBaseTable();
refTable = p.targetDescriptor().getBaseTable();
}
col.setReferences(refTable + "." + refColumn);
col.setForeignKeyName(foreignKeyConstraintName(col.getName()));
if (p.hasForeignKeyIndex()) {
col.setForeignKeyIndex(foreignKeyIndexName(col.getName()));
}
PropertyForeignKey foreignKey = p.getForeignKey();
PropertyForeignKey foreignKey = p.foreignKey();
if (foreignKey != null) {
col.setForeignKeyModes(foreignKey.getOnDelete(), foreignKey.getOnUpdate());
}
@@ -269,16 +269,16 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
// using non-strict mode to render the DB type such that we have a
// "logical" type like jsonb(200) that can map to JSONB or VARCHAR(200)
MColumn col = new MColumn(p.dbColumn(), ctx.getColumnDefn(p, false));
col.setComment(p.getDbComment());
col.setComment(p.dbComment());
col.setDraftOnly(p.isDraftOnly());
col.setHistoryExclude(p.isExcludedFromHistory());
if (p.isId() || p.isImportedPrimaryKey()) {
col.setPrimaryKey(true);
if (p.getBeanDescriptor().isUseIdGenerator()) {
if (p.descriptor().isUseIdGenerator()) {
col.setIdentity(true);
}
TableJoin primaryKeyJoin = p.getBeanDescriptor().getPrimaryKeyJoin();
TableJoin primaryKeyJoin = p.descriptor().primaryKeyJoin();
if (primaryKeyJoin != null && !table.isPartitioned()) {
final PropertyForeignKey foreignKey = primaryKeyJoin.getForeignKey();
if (foreignKey == null || !foreignKey.isNoConstraint()) {
@@ -291,22 +291,22 @@ public class ModelBuildPropertyVisitor extends BaseTablePropertyVisitor {
}
}
} else {
col.setDefaultValue(p.getDbColumnDefault());
col.setDefaultValue(p.dbColumnDefault());
if (allowNonNull && (!p.isNullable() || p.isDDLNotNull())) {
col.setNotnull(true);
}
}
col.setDbMigrationInfos(p.getDbMigrationInfos());
col.setDbMigrationInfos(p.dbMigrationInfos());
if (p.isUnique() && !p.isId()) {
col.setUnique(uniqueConstraintName(col.getName()));
indexSetAdd(col.getName());
}
Set<String> checkConstraintValues = p.getDbCheckConstraintValues();
Set<String> checkConstraintValues = p.dbCheckConstraintValues();
if (checkConstraintValues != null) {
if (beanDescriptor.hasInheritance()) {
InheritInfo inheritInfo = beanDescriptor.getInheritInfo();
InheritInfo inheritInfo = beanDescriptor.inheritInfo();
inheritInfo.appendCheckConstraintValues(p.name(), checkConstraintValues);
}
col.setCheckConstraint(buildCheckConstraint(p.dbColumn(), checkConstraintValues));