[#2257] Add List<IdentityDefinition>
Database.getIdentities(SchemaDefinition) for convenience to jooq-meta
This commit is contained in:
parent
e012c0e547
commit
300c4b8693
@ -93,6 +93,7 @@ public abstract class AbstractDatabase implements Database {
|
||||
private List<String> inputSchemata;
|
||||
private List<SchemaDefinition> schemata;
|
||||
private List<SequenceDefinition> sequences;
|
||||
private List<IdentityDefinition> identities;
|
||||
private List<TableDefinition> tables;
|
||||
private List<EnumDefinition> enums;
|
||||
private List<UDTDefinition> udts;
|
||||
@ -102,6 +103,7 @@ public abstract class AbstractDatabase implements Database {
|
||||
private Relations relations;
|
||||
|
||||
private transient Map<SchemaDefinition, List<SequenceDefinition>> sequencesBySchema;
|
||||
private transient Map<SchemaDefinition, List<IdentityDefinition>> identitiesBySchema;
|
||||
private transient Map<SchemaDefinition, List<TableDefinition>> tablesBySchema;
|
||||
private transient Map<SchemaDefinition, List<EnumDefinition>> enumsBySchema;
|
||||
private transient Map<SchemaDefinition, List<UDTDefinition>> udtsBySchema;
|
||||
@ -351,6 +353,29 @@ public abstract class AbstractDatabase implements Database {
|
||||
return filterSchema(sequences, schema, sequencesBySchema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<IdentityDefinition> getIdentities(SchemaDefinition schema) {
|
||||
if (identities == null) {
|
||||
identities = new ArrayList<IdentityDefinition>();
|
||||
|
||||
for (SchemaDefinition s : getSchemata()) {
|
||||
for (TableDefinition table : getTables(s)) {
|
||||
IdentityDefinition identity = table.getIdentity();
|
||||
|
||||
if (identity != null) {
|
||||
identities.add(identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (identitiesBySchema == null) {
|
||||
identitiesBySchema = new LinkedHashMap<SchemaDefinition, List<IdentityDefinition>>();
|
||||
}
|
||||
|
||||
return filterSchema(identities, schema, identitiesBySchema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final List<TableDefinition> getTables(SchemaDefinition schema) {
|
||||
if (tables == null) {
|
||||
|
||||
@ -73,6 +73,11 @@ public interface Database {
|
||||
*/
|
||||
List<SequenceDefinition> getSequences(SchemaDefinition schema);
|
||||
|
||||
/**
|
||||
* The identities contained in this database
|
||||
*/
|
||||
List<IdentityDefinition> getIdentities(SchemaDefinition schema);
|
||||
|
||||
/**
|
||||
* The tables contained in this database
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user