/** * A helper method for accessing the foreign {@link Table} referenced by * this key. * * @return the foreign {@link Table} referenced by this */ default Optional<? extends Table> findForeignTable() { final Optional<Schema> schema = ancestors() .filter(Schema.class::isInstance) .map(Schema.class::cast) .findFirst(); return schema.flatMap(s -> s.tables() .filter(tab -> tab.getId().equals(getForeignTableName())) .findAny() ); }
private SpeedmentException foreignKeyWasNullException() { return new SpeedmentException( "Could not find referenced foreign column '" + fkc.getForeignColumnName() + "' in table '" + fkc.getForeignTableName() + "'." ); } }
ImmutableForeignKeyColumn(ImmutableForeignKey parent, Map<String, Object> fkc) { super(parent, requireKeys(fkc, ForeignKeyColumn.FOREIGN_COLUMN_NAME, ForeignKeyColumn.FOREIGN_TABLE_NAME)); final ForeignKeyColumn prototype = new ForeignKeyColumnImpl(parent, fkc); this.id = prototype.getId(); this.name = prototype.getName(); this.ordinalPosition = prototype.getOrdinalPosition(); this.foreignTableName = prototype.getForeignTableName(); this.foreignColumnName = prototype.getForeignColumnName(); this.foreignTable = LazyReference.create(); this.foreignColumn = LazyReference.create(); this.column = LazyReference.create(); }
() -> new SpeedmentException( "Could not find referenced foreign table '" + fkc.getForeignTableName() + "'." ))).entityType();
private SpeedmentException foreignKeyWasNullException() { return new SpeedmentException( "Could not find referenced foreign column '" + fkc.getForeignColumnName() + "' in table '" + fkc.getForeignTableName() + "'." ); } }
() -> new SpeedmentException( "Could not find referenced foreign table '" + fkc.getForeignTableName() + "'." ))).entityType();