|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jooq.SchemaMapping
public class SchemaMapping
General mapping of generated artefacts onto run-time substitutes.
There are several use cases, when the run-time schema configuration may be
different from the compile-time (or code-generation-time) schema
configuration. Say, you develop a schema called DEV
. It contains
a table DEV.T
. When you install your database on a productive
system, you might have two schemata:
PROD
: The productive schema. It contains the table
PROD.T
BACKUP
: The productive backup schema. This schema might be
shared with other applications, so you might have table name collisions.
Therefore, you'd want to map your table DEV.T
onto
BACKUP.MY_T
This can be achieved with the SchemaMapping
, where you can map
schemata and tables, for them to render different names at run-time, than at
compile-time.
Field Summary | |
---|---|
static SchemaMapping |
NO_MAPPING
The default, unmodifiable mapping that just takes generated schemata |
Constructor Summary | |
---|---|
SchemaMapping()
Construct an empty mapping |
Method Summary | |
---|---|
void |
add(Schema generatedSchema,
Schema configuredSchema)
Add schemata to this mapping |
void |
add(Schema generatedSchema,
String configuredSchemaName)
Add schemata to this mapping |
void |
add(Table<?> generatedTable,
String configuredTableName)
Add tables to this mapping |
void |
add(Table<?> generatedTable,
Table<?> configuredTable)
Add tables to this mapping |
Schema |
map(Schema generatedSchema)
Apply mapping to a given schema |
Table<?> |
map(Table<?> generatedTable)
Apply mapping to a given table |
void |
setDefaultSchema(String schema)
Synonym for use(String) . |
void |
setSchemaMapping(Map<String,String> schemaMap)
Initialise SchemaMapping. |
String |
toString()
|
void |
use(Schema schema)
Set a schema as the default schema. |
void |
use(String schemaName)
Set a schema as the default schema. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final SchemaMapping NO_MAPPING
Constructor Detail |
---|
public SchemaMapping()
Method Detail |
---|
public void use(Schema schema)
If the supplied mapping has already been added using
add(Schema, Schema)
, then use()
has no effect.
schema
- the default schemapublic void use(String schemaName)
If the supplied mapping has already been added using
add(Schema, Schema)
, then use()
has no effect.
schemaName
- the default schemapublic void add(Schema generatedSchema, Schema configuredSchema)
generatedSchema
- The schema known at codegen time to be mappedconfiguredSchema
- The schema configured at run time to be mappedpublic void add(Schema generatedSchema, String configuredSchemaName)
generatedSchema
- The schema known at codegen time to be mappedconfiguredSchemaName
- The schema configured at run time to be
mappedpublic void add(Table<?> generatedTable, Table<?> configuredTable)
generatedTable
- The table known at codegen time to be mappedconfiguredTable
- The table configured at run time to be mappedpublic void add(Table<?> generatedTable, String configuredTableName)
generatedTable
- The table known at codegen time to be mappedconfiguredTableName
- The table configured at run time to be mappedpublic Schema map(Schema generatedSchema)
generatedSchema
- The generated schema to be mapped
public Table<?> map(Table<?> generatedTable)
generatedTable
- The generated table to be mapped
public void setDefaultSchema(String schema)
use(String)
. Added for better interoperability with
Spring
public void setSchemaMapping(Map<String,String> schemaMap)
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |