CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-jooq--jooq-meta

Database metadata abstraction library for jOOQ's code generation system providing unified access to schema information across multiple database vendors

Pending
Overview
Eval results
Files

configuration.mddocs/

Configuration and Customization

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

Capabilities

Include/Exclude Patterns

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

/**
 * Sets include patterns for database objects
 * @param includes - Array of regular expressions for objects to include
 */
void setIncludes(String[] includes);

/**
 * Gets include patterns
 * @returns Array of include regular expressions
 */
String[] getIncludes();

/**
 * Sets exclude patterns for database objects
 * @param excludes - Array of regular expressions for objects to exclude
 */
void setExcludes(String[] excludes);

/**
 * Gets exclude patterns
 * @returns Array of exclude regular expressions
 */
String[] getExcludes();

/**
 * Sets include SQL query for dynamic filtering
 * @param sql - SQL query returning object names to include
 */
void setIncludeSql(String sql);

/**
 * Gets include SQL query
 * @returns SQL query string for include filtering
 */
String getIncludeSql();

/**
 * Sets exclude SQL query for dynamic filtering
 * @param sql - SQL query returning object names to exclude
 */
void setExcludeSql(String sql);

/**
 * Gets exclude SQL query
 * @returns SQL query string for exclude filtering
 */
String getExcludeSql();

Usage Examples:

import org.jooq.meta.Database;

// Set include patterns
database.setIncludes(new String[]{
    "user.*",           // Include all objects starting with "user"
    "order.*",          // Include all objects starting with "order"
    ".*_view"           // Include all views ending with "_view"
});

// Set exclude patterns
database.setExcludes(new String[]{
    "temp_.*",          // Exclude temporary tables
    ".*_backup",        // Exclude backup tables
    "test_.*"           // Exclude test objects
});

// Dynamic include using SQL
database.setIncludeSql(
    "SELECT table_name FROM information_schema.tables " +
    "WHERE table_schema = 'public' AND table_type = 'BASE TABLE'"
);

// Dynamic exclude using SQL
database.setExcludeSql(
    "SELECT table_name FROM deprecated_tables"
);

// Get current patterns
String[] includes = database.getIncludes();
String[] excludes = database.getExcludes();

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

Object Type Filtering

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

/**
 * Sets whether to include foreign key relationships
 * @param includeForeignKeys - true to include foreign keys
 */
void setIncludeForeignKeys(boolean includeForeignKeys);

/**
 * Gets foreign key inclusion setting
 * @returns true if foreign keys are included
 */
boolean getIncludeForeignKeys();

/**
 * Sets whether to include unique keys
 * @param includeUniqueKeys - true to include unique keys
 */
void setIncludeUniqueKeys(boolean includeUniqueKeys);

/**
 * Gets unique key inclusion setting
 * @returns true if unique keys are included
 */
boolean getIncludeUniqueKeys();

/**
 * Sets whether to include primary keys
 * @param includePrimaryKeys - true to include primary keys
 */
void setIncludePrimaryKeys(boolean includePrimaryKeys);

/**
 * Gets primary key inclusion setting
 * @returns true if primary keys are included
 */
boolean getIncludePrimaryKeys();

/**
 * Sets whether to include check constraints
 * @param checkConstraints - true to include check constraints
 */
void setIncludeCheckConstraints(boolean checkConstraints);

/**
 * Gets check constraint inclusion setting
 * @returns true if check constraints are included
 */
boolean getIncludeCheckConstraints();

/**
 * Sets whether to include tables and views
 * @param includeTables - true to include tables
 */
void setIncludeTables(boolean includeTables);

/**
 * Gets table inclusion setting
 * @returns true if tables are included
 */
boolean getIncludeTables();

/**
 * Sets whether to include routines (procedures/functions)
 * @param includeRoutines - true to include routines
 */
void setIncludeRoutines(boolean includeRoutines);

/**
 * Gets routine inclusion setting
 * @returns true if routines are included
 */
boolean getIncludeRoutines();

/**
 * Sets whether to include sequences
 * @param includeSequences - true to include sequences
 */
void setIncludeSequences(boolean includeSequences);

/**
 * Gets sequence inclusion setting
 * @returns true if sequences are included
 */
boolean getIncludeSequences();

/**
 * Sets whether to include user-defined types
 * @param includeUDTs - true to include UDTs
 */
void setIncludeUDTs(boolean includeUDTs);

/**
 * Gets UDT inclusion setting
 * @returns true if UDTs are included
 */
boolean getIncludeUDTs();

/**
 * Sets whether to include indexes
 * @param includeIndexes - true to include indexes
 */
void setIncludeIndexes(boolean includeIndexes);

/**
 * Gets index inclusion setting
 * @returns true if indexes are included
 */
boolean getIncludeIndexes();

Usage Examples:

// Configure which object types to include
database.setIncludeTables(true);
database.setIncludeRoutines(true);
database.setIncludeSequences(true);
database.setIncludeUDTs(false);           // Skip UDTs
database.setIncludeIndexes(false);        // Skip indexes for faster processing

// Configure constraint inclusion
database.setIncludeForeignKeys(true);
database.setIncludeUniqueKeys(true);
database.setIncludePrimaryKeys(true);
database.setIncludeCheckConstraints(false); // Skip check constraints

// System object filtering
database.setIncludeSystemTables(false);
database.setIncludeSystemIndexes(false);
database.setIncludeSystemSequences(false);

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

Column-Level Filtering

Advanced filtering options for column-level inclusion and exclusion.

/**
 * Sets whether include/exclude patterns apply to columns
 * @param includeExcludeColumns - true to apply patterns to columns
 */
void setIncludeExcludeColumns(boolean includeExcludeColumns);

/**
 * Gets column filtering setting
 * @returns true if patterns apply to columns
 */
boolean getIncludeExcludeColumns();

/**
 * Sets whether to include invisible columns
 * @param includeInvisibleColumns - true to include invisible columns
 */
void setIncludeInvisibleColumns(boolean includeInvisibleColumns);

/**
 * Gets invisible column inclusion setting
 * @returns true if invisible columns are included
 */
boolean getIncludeInvisibleColumns();

/**
 * Sets whether invisible columns should be marked as hidden
 * @param invisibleColumnsAsHidden - true to mark as hidden
 */
void setInvisibleColumnsAsHidden(boolean invisibleColumnsAsHidden);

/**
 * Gets invisible columns as hidden setting
 * @returns true if invisible columns are marked as hidden
 */
boolean getInvisibleColumnsAsHidden();

Forced Type Configuration

Advanced type mapping system for customizing Java type generation.

/**
 * Sets forced type configurations
 * @param types - List of forced type configurations
 */
void setConfiguredForcedTypes(List<ForcedType> types);

/**
 * Gets forced type configurations
 * @returns List of configured forced types
 */
List<ForcedType> getConfiguredForcedTypes();

/**
 * Gets forced type for a specific definition
 * @param definition - Definition to get forced type for
 * @returns ForcedType configuration or null if none matches
 */
ForcedType getConfiguredForcedType(Definition definition);

/**
 * Gets forced type for definition with data type
 * @param definition - Definition to get forced type for
 * @param definedType - Data type definition context
 * @returns ForcedType configuration or null if none matches
 */
ForcedType getConfiguredForcedType(Definition definition, DataTypeDefinition definedType);

/**
 * Marks a forced type as used during processing
 * @param forcedType - Forced type to mark as used
 */
void markUsed(ForcedType forcedType);

/**
 * Gets unused forced types for validation
 * @returns List of forced types that were not applied
 */
List<ForcedType> getUnusedForcedTypes();

Usage Examples:

import org.jooq.meta.jaxb.ForcedType;
import java.util.Arrays;

// Configure forced types
ForcedType uuidType = new ForcedType();
uuidType.setName("java.util.UUID");
uuidType.setIncludeExpression(".*\\.uuid");
uuidType.setIncludeTypes("UUID|uuid");

ForcedType jsonType = new ForcedType();
jsonType.setName("com.fasterxml.jackson.databind.JsonNode");
jsonType.setIncludeExpression(".*\\.json_data");
jsonType.setIncludeTypes("JSON|JSONB");

ForcedType timestampType = new ForcedType();
timestampType.setName("java.time.LocalDateTime");
timestampType.setIncludeTypes("TIMESTAMP.*");

database.setConfiguredForcedTypes(Arrays.asList(
    uuidType, jsonType, timestampType
));

// Check forced type usage
List<ForcedType> unused = database.getUnusedForcedTypes();
if (!unused.isEmpty()) {
    System.out.println("Warning: " + unused.size() + " forced types were not used");
}

Synthetic Object Configuration

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

/**
 * Sets synthetic object configurations
 * @param configuredSyntheticObjects - Synthetic objects configuration
 */
void setConfiguredSyntheticObjects(SyntheticObjectsType configuredSyntheticObjects);

/**
 * Gets synthetic column configurations
 * @returns List of synthetic column configurations
 */
List<SyntheticColumnType> getConfiguredSyntheticColumns();

/**
 * Gets synthetic primary key configurations
 * @returns List of synthetic primary key configurations
 */
List<SyntheticPrimaryKeyType> getConfiguredSyntheticPrimaryKeys();

/**
 * Gets synthetic unique key configurations
 * @returns List of synthetic unique key configurations
 */
List<SyntheticUniqueKeyType> getConfiguredSyntheticUniqueKeys();

/**
 * Gets synthetic foreign key configurations
 * @returns List of synthetic foreign key configurations
 */
List<SyntheticForeignKeyType> getConfiguredSyntheticForeignKeys();

/**
 * Gets synthetic view configurations
 * @returns List of synthetic view configurations
 */
List<SyntheticViewType> getConfiguredSyntheticViews();

/**
 * Marks synthetic objects as used during processing
 * @param column - Synthetic column to mark as used
 */
void markUsed(SyntheticColumnType column);

/**
 * Gets unused synthetic columns for validation
 * @returns List of synthetic columns that were not applied
 */
List<SyntheticColumnType> getUnusedSyntheticColumns();

Custom Filters

Advanced filtering using custom filter implementations.

/**
 * Adds a custom filter for advanced filtering logic
 * @param filter - Custom filter implementation
 */
void addFilter(Filter filter);

/**
 * Gets all configured custom filters
 * @returns List of custom filter implementations
 */
List<Filter> getFilters();

/**
 * Filters definitions using exclude/include patterns
 * @param definitions - List of definitions to filter
 * @returns Filtered list of definitions
 */
<D extends Definition> List<D> filterExcludeInclude(List<D> definitions);

/**
 * Filters definitions using specific exclude/include expressions
 * @param definitions - List of definitions to filter
 * @param exclude - Exclude pattern to apply
 * @param include - Include pattern to apply
 * @returns Filtered list of definitions
 */
<D extends Definition> List<D> filterExcludeInclude(List<D> definitions, String exclude, String include);

Usage Examples:

import org.jooq.meta.Database.Filter;
import org.jooq.meta.Definition;

// Custom filter implementation
Filter customFilter = new Filter() {
    @Override
    public boolean exclude(Definition definition) {
        // Exclude tables with specific naming pattern
        if (definition instanceof TableDefinition) {
            String name = definition.getName();
            return name.startsWith("temp_") || name.contains("_old_");
        }
        return false;
    }
};

database.addFilter(customFilter);

// Apply filtering to definitions
List<TableDefinition> tables = database.getTables();
List<TableDefinition> filtered = database.filterExcludeInclude(tables);

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

Regular Expression Configuration

Advanced regex configuration for pattern matching behavior.

/**
 * Sets regular expression flags
 * @param regexFlags - List of regex flags to apply
 */
void setRegexFlags(List<RegexFlag> regexFlags);

/**
 * Gets regular expression flags
 * @returns List of configured regex flags
 */
List<RegexFlag> getRegexFlags();

/**
 * Sets whether regex matches partially qualified names
 * @param regexMatchesPartialQualification - true to match partial names
 */
void setRegexMatchesPartialQualification(boolean regexMatchesPartialQualification);

/**
 * Gets regex partial qualification matching setting
 * @returns true if regex matches partial names
 */
boolean getRegexMatchesPartialQualification();

/**
 * Sets whether SQL matches partially qualified names
 * @param sqlMatchesPartialQualification - true to match partial names in SQL
 */
void setSqlMatchesPartialQualification(boolean sqlMatchesPartialQualification);

/**
 * Gets SQL partial qualification matching setting
 * @returns true if SQL matches partial names
 */
boolean getSqlMatchesPartialQualification();

Schema and Catalog Mapping

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

/**
 * Sets catalog mapping configurations
 * @param catalogs - List of catalog mapping configurations
 */
void setConfiguredCatalogs(List<CatalogMappingType> catalogs);

/**
 * Sets schema mapping configurations
 * @param schemata - List of schema mapping configurations
 */
void setConfiguredSchemata(List<SchemaMappingType> schemata);

Types

interface Filter {
    /**
     * Determines whether to exclude a definition from processing
     * @param definition - Definition to evaluate
     * @returns true if definition should be excluded
     */
    boolean exclude(Definition definition);
}

enum RegexFlag {
    CASE_INSENSITIVE,
    MULTILINE,
    DOTALL,
    UNICODE_CASE,
    CANON_EQ,
    UNIX_LINES
}

enum OnError {
    /** Fail immediately on any error */
    FAIL,
    /** Log errors and continue processing */
    LOG,
    /** Ignore errors silently */
    SILENT
}

Usage Examples:

import org.jooq.meta.Database;
import org.jooq.meta.jaxb.*;
import java.util.Arrays;

// Complete database configuration
Database database = Databases.database(SQLDialect.POSTGRES);

// Basic filtering
database.setIncludes(new String[]{"public\\..*", "app\\..*"});
database.setExcludes(new String[]{".*_temp", ".*_backup"});

// Object type filtering
database.setIncludeTables(true);
database.setIncludeRoutines(true);
database.setIncludeSequences(true);
database.setIncludeIndexes(false);
database.setIncludeSystemTables(false);

// Column filtering
database.setIncludeExcludeColumns(true);
database.setIncludeInvisibleColumns(false);

// Error handling
database.setOnError(OnError.LOG);

// Regex configuration
database.setRegexFlags(Arrays.asList(RegexFlag.CASE_INSENSITIVE));
database.setRegexMatchesPartialQualification(true);

// Custom forced types
ForcedType timestampType = new ForcedType();
timestampType.setName("java.time.LocalDateTime");
timestampType.setIncludeTypes("TIMESTAMP.*");

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

// Connect and process
database.setConnection(connection);

// The database will now apply all configured filters and mappings
List<TableDefinition> tables = database.getTables();
System.out.println("Found " + tables.size() + " tables after filtering");

Install with Tessl CLI

npx tessl i tessl/maven-org-jooq--jooq-meta

docs

advanced-objects.md

configuration.md

constraints-relationships.md

database-implementations.md

database-management.md

index.md

schema-discovery.md

table-analysis.md

tile.json