/** * Generates the {@link Index} example (taken from {@link IndexExistsPrecondition}). * * @param database the database instance. * @param schema the schema instance. * @param tableName the table name of the index. * @return the index example. */ protected Index getIndexExample( final Database database, final Schema schema, final String tableName) { final Index example = new Index(); if (tableName != null) { example.setTable( (Table) new Table() .setName(database.correctObjectName(getTableName(), Table.class)) .setSchema(schema)); } example.setName(database.correctObjectName(getIndexName(), Index.class)); if (StringUtils.trimToNull(getColumnNames()) != null) { for (final String columnName : getColumnNames().split("\\s*,\\s*")) { final Column column = new Column(database.correctObjectName(columnName, Column.class)); example.getColumns().add(column); } } return example; }