/** * Debug method used to track type mappers of a project. May be of future use if one perhaps would venture to * investigate why we get several copies of the dbms from the database */ private void printTypeMappers(String heading, Project p) { System.out.println(heading); p.dbmses().map(d -> (Dbms) d).forEach(dbms -> { dbms.schemas().map(s -> (Schema) s).forEach(schema -> { schema.tables().map(t -> (Table) t).forEach(table -> { table.columns().map(c -> (Column) c).filter(c -> c.getTypeMapper().isPresent()).forEach(column -> { String mapperName = column.getTypeMapper().get(); if (mapperName.endsWith("PrimitiveTypeMapper")) { mapperName = "Primitive"; } System.out.println(" - " + dbms.getName() + ":" + schema.getName() + "/" + table.getName() + "." + column.getName() + " mapped by " + mapperName); }); }); }); }); }
/** * Returns the full name used in the database for the specified * {@link Column}. This is typically constructed by combining the table and * the column name with a separator, but that might be different in * different implementations. * * @param column the column to retrieve the name of * @return the full name */ default String fullNameOf(Column column) { final Table table = column.getParentOrThrow(); final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName(), column.getName()); }
ImmutableColumn(ImmutableTable parent, Map<String, Object> data) { super(parent, data); final Column prototype = new ColumnImpl(parent, data); this.enabled = prototype.isEnabled(); this.id = prototype.getId(); this.name = prototype.getName(); this.alias = prototype.getAlias(); this.nullable = prototype.isNullable(); this.nullableImplementation = prototype.getNullableImplementation(); this.autoincrement = prototype.isAutoIncrement(); this.typeMapper = prototype.getTypeMapper(); this.databaseType = prototype.getDatabaseType(); this.databaseTypeObject = prototype.findDatabaseType(); this.enumConstants = prototype.getEnumConstants(); this.decimalDigits = prototype.getDecimalDigits(); this.columnSize = prototype.getColumnSize(); this.ordinalPosition = prototype.getOrdinalPosition(); }
final String schemaName = ancestor(col, Schema.class).get().getName(); final String tableName = col.getParentOrThrow().getName(); final String columnName = col.getName();
/** * Returns the full name used in the database for the specified * {@link Column}. This is typically constructed by combining the table and * the column name with a separator, but that might be different in * different implementations. * * @param column the column to retrieve the name of * @return the full name */ default String fullNameOf(Column column) { final Table table = column.getParentOrThrow(); final Schema schema = table.getParentOrThrow(); return fullNameOf(schema.getName(), table.getName(), column.getName()); }