or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

advanced-objects.mdconfiguration.mdconstraints-relationships.mddatabase-implementations.mddatabase-management.mdindex.mdschema-discovery.mdtable-analysis.md

configuration.mddocs/

0

# Configuration and Customization

1

2

Flexible configuration system supporting include/exclude patterns, forced types, synthetic objects, filtering, and advanced customization options for tailored metadata extraction.

3

4

## Capabilities

5

6

### Include/Exclude Patterns

7

8

Pattern-based filtering for selective metadata extraction using regular expressions.

9

10

```java { .api }

11

/**

12

* Sets include patterns for database objects

13

* @param includes - Array of regular expressions for objects to include

14

*/

15

void setIncludes(String[] includes);

16

17

/**

18

* Gets include patterns

19

* @returns Array of include regular expressions

20

*/

21

String[] getIncludes();

22

23

/**

24

* Sets exclude patterns for database objects

25

* @param excludes - Array of regular expressions for objects to exclude

26

*/

27

void setExcludes(String[] excludes);

28

29

/**

30

* Gets exclude patterns

31

* @returns Array of exclude regular expressions

32

*/

33

String[] getExcludes();

34

35

/**

36

* Sets include SQL query for dynamic filtering

37

* @param sql - SQL query returning object names to include

38

*/

39

void setIncludeSql(String sql);

40

41

/**

42

* Gets include SQL query

43

* @returns SQL query string for include filtering

44

*/

45

String getIncludeSql();

46

47

/**

48

* Sets exclude SQL query for dynamic filtering

49

* @param sql - SQL query returning object names to exclude

50

*/

51

void setExcludeSql(String sql);

52

53

/**

54

* Gets exclude SQL query

55

* @returns SQL query string for exclude filtering

56

*/

57

String getExcludeSql();

58

```

59

60

**Usage Examples:**

61

62

```java

63

import org.jooq.meta.Database;

64

65

// Set include patterns

66

database.setIncludes(new String[]{

67

"user.*", // Include all objects starting with "user"

68

"order.*", // Include all objects starting with "order"

69

".*_view" // Include all views ending with "_view"

70

});

71

72

// Set exclude patterns

73

database.setExcludes(new String[]{

74

"temp_.*", // Exclude temporary tables

75

".*_backup", // Exclude backup tables

76

"test_.*" // Exclude test objects

77

});

78

79

// Dynamic include using SQL

80

database.setIncludeSql(

81

"SELECT table_name FROM information_schema.tables " +

82

"WHERE table_schema = 'public' AND table_type = 'BASE TABLE'"

83

);

84

85

// Dynamic exclude using SQL

86

database.setExcludeSql(

87

"SELECT table_name FROM deprecated_tables"

88

);

89

90

// Get current patterns

91

String[] includes = database.getIncludes();

92

String[] excludes = database.getExcludes();

93

94

System.out.println("Include patterns: " + Arrays.toString(includes));

95

System.out.println("Exclude patterns: " + Arrays.toString(excludes));

96

```

97

98

### Object Type Filtering

99

100

Fine-grained control over which types of database objects to include.

101

102

```java { .api }

103

/**

104

* Sets whether to include foreign key relationships

105

* @param includeForeignKeys - true to include foreign keys

106

*/

107

void setIncludeForeignKeys(boolean includeForeignKeys);

108

109

/**

110

* Gets foreign key inclusion setting

111

* @returns true if foreign keys are included

112

*/

113

boolean getIncludeForeignKeys();

114

115

/**

116

* Sets whether to include unique keys

117

* @param includeUniqueKeys - true to include unique keys

118

*/

119

void setIncludeUniqueKeys(boolean includeUniqueKeys);

120

121

/**

122

* Gets unique key inclusion setting

123

* @returns true if unique keys are included

124

*/

125

boolean getIncludeUniqueKeys();

126

127

/**

128

* Sets whether to include primary keys

129

* @param includePrimaryKeys - true to include primary keys

130

*/

131

void setIncludePrimaryKeys(boolean includePrimaryKeys);

132

133

/**

134

* Gets primary key inclusion setting

135

* @returns true if primary keys are included

136

*/

137

boolean getIncludePrimaryKeys();

138

139

/**

140

* Sets whether to include check constraints

141

* @param checkConstraints - true to include check constraints

142

*/

143

void setIncludeCheckConstraints(boolean checkConstraints);

144

145

/**

146

* Gets check constraint inclusion setting

147

* @returns true if check constraints are included

148

*/

149

boolean getIncludeCheckConstraints();

150

151

/**

152

* Sets whether to include tables and views

153

* @param includeTables - true to include tables

154

*/

155

void setIncludeTables(boolean includeTables);

156

157

/**

158

* Gets table inclusion setting

159

* @returns true if tables are included

160

*/

161

boolean getIncludeTables();

162

163

/**

164

* Sets whether to include routines (procedures/functions)

165

* @param includeRoutines - true to include routines

166

*/

167

void setIncludeRoutines(boolean includeRoutines);

168

169

/**

170

* Gets routine inclusion setting

171

* @returns true if routines are included

172

*/

173

boolean getIncludeRoutines();

174

175

/**

176

* Sets whether to include sequences

177

* @param includeSequences - true to include sequences

178

*/

179

void setIncludeSequences(boolean includeSequences);

180

181

/**

182

* Gets sequence inclusion setting

183

* @returns true if sequences are included

184

*/

185

boolean getIncludeSequences();

186

187

/**

188

* Sets whether to include user-defined types

189

* @param includeUDTs - true to include UDTs

190

*/

191

void setIncludeUDTs(boolean includeUDTs);

192

193

/**

194

* Gets UDT inclusion setting

195

* @returns true if UDTs are included

196

*/

197

boolean getIncludeUDTs();

198

199

/**

200

* Sets whether to include indexes

201

* @param includeIndexes - true to include indexes

202

*/

203

void setIncludeIndexes(boolean includeIndexes);

204

205

/**

206

* Gets index inclusion setting

207

* @returns true if indexes are included

208

*/

209

boolean getIncludeIndexes();

210

```

211

212

**Usage Examples:**

213

214

```java

215

// Configure which object types to include

216

database.setIncludeTables(true);

217

database.setIncludeRoutines(true);

218

database.setIncludeSequences(true);

219

database.setIncludeUDTs(false); // Skip UDTs

220

database.setIncludeIndexes(false); // Skip indexes for faster processing

221

222

// Configure constraint inclusion

223

database.setIncludeForeignKeys(true);

224

database.setIncludeUniqueKeys(true);

225

database.setIncludePrimaryKeys(true);

226

database.setIncludeCheckConstraints(false); // Skip check constraints

227

228

// System object filtering

229

database.setIncludeSystemTables(false);

230

database.setIncludeSystemIndexes(false);

231

database.setIncludeSystemSequences(false);

232

233

System.out.println("Including foreign keys: " + database.getIncludeForeignKeys());

234

System.out.println("Including UDTs: " + database.getIncludeUDTs());

235

```

236

237

### Column-Level Filtering

238

239

Advanced filtering options for column-level inclusion and exclusion.

240

241

```java { .api }

242

/**

243

* Sets whether include/exclude patterns apply to columns

244

* @param includeExcludeColumns - true to apply patterns to columns

245

*/

246

void setIncludeExcludeColumns(boolean includeExcludeColumns);

247

248

/**

249

* Gets column filtering setting

250

* @returns true if patterns apply to columns

251

*/

252

boolean getIncludeExcludeColumns();

253

254

/**

255

* Sets whether to include invisible columns

256

* @param includeInvisibleColumns - true to include invisible columns

257

*/

258

void setIncludeInvisibleColumns(boolean includeInvisibleColumns);

259

260

/**

261

* Gets invisible column inclusion setting

262

* @returns true if invisible columns are included

263

*/

264

boolean getIncludeInvisibleColumns();

265

266

/**

267

* Sets whether invisible columns should be marked as hidden

268

* @param invisibleColumnsAsHidden - true to mark as hidden

269

*/

270

void setInvisibleColumnsAsHidden(boolean invisibleColumnsAsHidden);

271

272

/**

273

* Gets invisible columns as hidden setting

274

* @returns true if invisible columns are marked as hidden

275

*/

276

boolean getInvisibleColumnsAsHidden();

277

```

278

279

### Forced Type Configuration

280

281

Advanced type mapping system for customizing Java type generation.

282

283

```java { .api }

284

/**

285

* Sets forced type configurations

286

* @param types - List of forced type configurations

287

*/

288

void setConfiguredForcedTypes(List<ForcedType> types);

289

290

/**

291

* Gets forced type configurations

292

* @returns List of configured forced types

293

*/

294

List<ForcedType> getConfiguredForcedTypes();

295

296

/**

297

* Gets forced type for a specific definition

298

* @param definition - Definition to get forced type for

299

* @returns ForcedType configuration or null if none matches

300

*/

301

ForcedType getConfiguredForcedType(Definition definition);

302

303

/**

304

* Gets forced type for definition with data type

305

* @param definition - Definition to get forced type for

306

* @param definedType - Data type definition context

307

* @returns ForcedType configuration or null if none matches

308

*/

309

ForcedType getConfiguredForcedType(Definition definition, DataTypeDefinition definedType);

310

311

/**

312

* Marks a forced type as used during processing

313

* @param forcedType - Forced type to mark as used

314

*/

315

void markUsed(ForcedType forcedType);

316

317

/**

318

* Gets unused forced types for validation

319

* @returns List of forced types that were not applied

320

*/

321

List<ForcedType> getUnusedForcedTypes();

322

```

323

324

**Usage Examples:**

325

326

```java

327

import org.jooq.meta.jaxb.ForcedType;

328

import java.util.Arrays;

329

330

// Configure forced types

331

ForcedType uuidType = new ForcedType();

332

uuidType.setName("java.util.UUID");

333

uuidType.setIncludeExpression(".*\\.uuid");

334

uuidType.setIncludeTypes("UUID|uuid");

335

336

ForcedType jsonType = new ForcedType();

337

jsonType.setName("com.fasterxml.jackson.databind.JsonNode");

338

jsonType.setIncludeExpression(".*\\.json_data");

339

jsonType.setIncludeTypes("JSON|JSONB");

340

341

ForcedType timestampType = new ForcedType();

342

timestampType.setName("java.time.LocalDateTime");

343

timestampType.setIncludeTypes("TIMESTAMP.*");

344

345

database.setConfiguredForcedTypes(Arrays.asList(

346

uuidType, jsonType, timestampType

347

));

348

349

// Check forced type usage

350

List<ForcedType> unused = database.getUnusedForcedTypes();

351

if (!unused.isEmpty()) {

352

System.out.println("Warning: " + unused.size() + " forced types were not used");

353

}

354

```

355

356

### Synthetic Object Configuration

357

358

Configuration for synthetic database objects not present in the actual schema.

359

360

```java { .api }

361

/**

362

* Sets synthetic object configurations

363

* @param configuredSyntheticObjects - Synthetic objects configuration

364

*/

365

void setConfiguredSyntheticObjects(SyntheticObjectsType configuredSyntheticObjects);

366

367

/**

368

* Gets synthetic column configurations

369

* @returns List of synthetic column configurations

370

*/

371

List<SyntheticColumnType> getConfiguredSyntheticColumns();

372

373

/**

374

* Gets synthetic primary key configurations

375

* @returns List of synthetic primary key configurations

376

*/

377

List<SyntheticPrimaryKeyType> getConfiguredSyntheticPrimaryKeys();

378

379

/**

380

* Gets synthetic unique key configurations

381

* @returns List of synthetic unique key configurations

382

*/

383

List<SyntheticUniqueKeyType> getConfiguredSyntheticUniqueKeys();

384

385

/**

386

* Gets synthetic foreign key configurations

387

* @returns List of synthetic foreign key configurations

388

*/

389

List<SyntheticForeignKeyType> getConfiguredSyntheticForeignKeys();

390

391

/**

392

* Gets synthetic view configurations

393

* @returns List of synthetic view configurations

394

*/

395

List<SyntheticViewType> getConfiguredSyntheticViews();

396

397

/**

398

* Marks synthetic objects as used during processing

399

* @param column - Synthetic column to mark as used

400

*/

401

void markUsed(SyntheticColumnType column);

402

403

/**

404

* Gets unused synthetic columns for validation

405

* @returns List of synthetic columns that were not applied

406

*/

407

List<SyntheticColumnType> getUnusedSyntheticColumns();

408

```

409

410

### Custom Filters

411

412

Advanced filtering using custom filter implementations.

413

414

```java { .api }

415

/**

416

* Adds a custom filter for advanced filtering logic

417

* @param filter - Custom filter implementation

418

*/

419

void addFilter(Filter filter);

420

421

/**

422

* Gets all configured custom filters

423

* @returns List of custom filter implementations

424

*/

425

List<Filter> getFilters();

426

427

/**

428

* Filters definitions using exclude/include patterns

429

* @param definitions - List of definitions to filter

430

* @returns Filtered list of definitions

431

*/

432

<D extends Definition> List<D> filterExcludeInclude(List<D> definitions);

433

434

/**

435

* Filters definitions using specific exclude/include expressions

436

* @param definitions - List of definitions to filter

437

* @param exclude - Exclude pattern to apply

438

* @param include - Include pattern to apply

439

* @returns Filtered list of definitions

440

*/

441

<D extends Definition> List<D> filterExcludeInclude(List<D> definitions, String exclude, String include);

442

```

443

444

**Usage Examples:**

445

446

```java

447

import org.jooq.meta.Database.Filter;

448

import org.jooq.meta.Definition;

449

450

// Custom filter implementation

451

Filter customFilter = new Filter() {

452

@Override

453

public boolean exclude(Definition definition) {

454

// Exclude tables with specific naming pattern

455

if (definition instanceof TableDefinition) {

456

String name = definition.getName();

457

return name.startsWith("temp_") || name.contains("_old_");

458

}

459

return false;

460

}

461

};

462

463

database.addFilter(customFilter);

464

465

// Apply filtering to definitions

466

List<TableDefinition> tables = database.getTables();

467

List<TableDefinition> filtered = database.filterExcludeInclude(tables);

468

469

System.out.println("Original tables: " + tables.size());

470

System.out.println("Filtered tables: " + filtered.size());

471

```

472

473

### Regular Expression Configuration

474

475

Advanced regex configuration for pattern matching behavior.

476

477

```java { .api }

478

/**

479

* Sets regular expression flags

480

* @param regexFlags - List of regex flags to apply

481

*/

482

void setRegexFlags(List<RegexFlag> regexFlags);

483

484

/**

485

* Gets regular expression flags

486

* @returns List of configured regex flags

487

*/

488

List<RegexFlag> getRegexFlags();

489

490

/**

491

* Sets whether regex matches partially qualified names

492

* @param regexMatchesPartialQualification - true to match partial names

493

*/

494

void setRegexMatchesPartialQualification(boolean regexMatchesPartialQualification);

495

496

/**

497

* Gets regex partial qualification matching setting

498

* @returns true if regex matches partial names

499

*/

500

boolean getRegexMatchesPartialQualification();

501

502

/**

503

* Sets whether SQL matches partially qualified names

504

* @param sqlMatchesPartialQualification - true to match partial names in SQL

505

*/

506

void setSqlMatchesPartialQualification(boolean sqlMatchesPartialQualification);

507

508

/**

509

* Gets SQL partial qualification matching setting

510

* @returns true if SQL matches partial names

511

*/

512

boolean getSqlMatchesPartialQualification();

513

```

514

515

### Schema and Catalog Mapping

516

517

Configuration for mapping input schema/catalog names to output names.

518

519

```java { .api }

520

/**

521

* Sets catalog mapping configurations

522

* @param catalogs - List of catalog mapping configurations

523

*/

524

void setConfiguredCatalogs(List<CatalogMappingType> catalogs);

525

526

/**

527

* Sets schema mapping configurations

528

* @param schemata - List of schema mapping configurations

529

*/

530

void setConfiguredSchemata(List<SchemaMappingType> schemata);

531

```

532

533

## Types

534

535

```java { .api }

536

interface Filter {

537

/**

538

* Determines whether to exclude a definition from processing

539

* @param definition - Definition to evaluate

540

* @returns true if definition should be excluded

541

*/

542

boolean exclude(Definition definition);

543

}

544

545

enum RegexFlag {

546

CASE_INSENSITIVE,

547

MULTILINE,

548

DOTALL,

549

UNICODE_CASE,

550

CANON_EQ,

551

UNIX_LINES

552

}

553

554

enum OnError {

555

/** Fail immediately on any error */

556

FAIL,

557

/** Log errors and continue processing */

558

LOG,

559

/** Ignore errors silently */

560

SILENT

561

}

562

```

563

564

**Usage Examples:**

565

566

```java

567

import org.jooq.meta.Database;

568

import org.jooq.meta.jaxb.*;

569

import java.util.Arrays;

570

571

// Complete database configuration

572

Database database = Databases.database(SQLDialect.POSTGRES);

573

574

// Basic filtering

575

database.setIncludes(new String[]{"public\\..*", "app\\..*"});

576

database.setExcludes(new String[]{".*_temp", ".*_backup"});

577

578

// Object type filtering

579

database.setIncludeTables(true);

580

database.setIncludeRoutines(true);

581

database.setIncludeSequences(true);

582

database.setIncludeIndexes(false);

583

database.setIncludeSystemTables(false);

584

585

// Column filtering

586

database.setIncludeExcludeColumns(true);

587

database.setIncludeInvisibleColumns(false);

588

589

// Error handling

590

database.setOnError(OnError.LOG);

591

592

// Regex configuration

593

database.setRegexFlags(Arrays.asList(RegexFlag.CASE_INSENSITIVE));

594

database.setRegexMatchesPartialQualification(true);

595

596

// Custom forced types

597

ForcedType timestampType = new ForcedType();

598

timestampType.setName("java.time.LocalDateTime");

599

timestampType.setIncludeTypes("TIMESTAMP.*");

600

601

database.setConfiguredForcedTypes(Arrays.asList(timestampType));

602

603

// Connect and process

604

database.setConnection(connection);

605

606

// The database will now apply all configured filters and mappings

607

List<TableDefinition> tables = database.getTables();

608

System.out.println("Found " + tables.size() + " tables after filtering");

609

```