| java.lang.Object org.apache.openjpa.jdbc.meta.MappingInfo
All known Subclasses: org.apache.openjpa.jdbc.meta.FieldMappingInfo, org.apache.openjpa.jdbc.meta.VersionMappingInfo, org.apache.openjpa.jdbc.meta.ClassMappingInfo, org.apache.openjpa.jdbc.meta.ValueMappingInfo, org.apache.openjpa.jdbc.meta.DiscriminatorMappingInfo,
MappingInfo | abstract public class MappingInfo implements Serializable(Code) | | Base class storing raw mapping information; defines utility methods for
converting raw mapping information to full mapping to the schema.
author: Abe White |
Inner Class :public static interface TableDefaults | |
Inner Class :public static interface ForeignKeyDefaults | |
Method Summary | |
public void | assertNoForeignKey(MetaDataContext context, boolean die) Assert that the user did not try to place a foreign key on this mapping. | public void | assertNoIndex(MetaDataContext context, boolean die) Assert that the user did not try to place an index on this mapping. | public void | assertNoJoin(MetaDataContext context, boolean die) Assert that the user did not try to join. | public void | assertNoSchemaComponents(MetaDataContext context, boolean die) Assert that the user did not supply any columns, index, unique
constraint, or foreign key for this mapping. | public void | assertNoUnique(MetaDataContext context, boolean die) Assert that the user did not try to place a unique constraint on this
mapping. | public void | assertStrategy(MetaDataContext context, Object contextStrat, Object expected, boolean die) Assert that this info has the given strategy or no strategy. | public boolean | canForeignKey() The user can mark columns as explicitly not having a foreign key. | public boolean | canIndex() The user can mark columns as explicitly non-indexable. | public boolean | canUnique() The user can mark columns as explicitly not having a unique constraint. | public void | clear() Clear all mapping information. | protected void | clear(boolean canFlags) Clear mapping information. | public void | copy(MappingInfo info) Copy missing info from the instance to this one. | protected Column[] | createColumns(MetaDataContext context, String prefix, Column[] tmplates, Table table, boolean adapt) Retrieve/create columns on the given table by merging the given
template information with any user-provided information. | protected ForeignKey | createForeignKey(MetaDataContext context, String prefix, List given, ForeignKeyDefaults def, Table table, ClassMapping cls, ClassMapping rel, boolean inversable, boolean adapt) Retrieve/create a foreign key (possibly logical) on the given columns
by merging the given template information with any user-provided
information. | protected Index | createIndex(MetaDataContext context, String prefix, Index tmplate, Column[] cols, boolean adapt) Retrieve/create an index on the given columns by merging the given
template information with any user-provided information. | public Table | createTable(MetaDataContext context, TableDefaults def, String schemaName, String given, boolean adapt) Find or generate a table for a mapping. | protected Unique | createUnique(MetaDataContext context, String prefix, Unique tmplate, Column[] cols, boolean adapt) Retrieve/create a unique constraint on the given columns by merging the
given template information with any user-provided information. | public ColumnIO | getColumnIO() I/O for the columns created by the last call to
MappingInfo.createColumns ,
or for the foreign key created by the last call to
MappingInfo.createForeignKey . | public List | getColumns() Raw column data. | public ForeignKey | getForeignKey() Raw foreign key information. | public Index | getIndex() Raw index. | public int | getJoinDirection() Direction of the join that the columns of this mapping info form. | public String | getStrategy() Mapping strategy name. | public Unique | getUnique() Raw unique constraint information. | public boolean | hasSchemaComponents() Return true if this info has columns, foreign key information, index
information, etc. | protected static Column | mergeColumn(MetaDataContext context, String prefix, Column tmplate, boolean compat, Column given, Table table, boolean adapt, boolean fill) Merge the given columns if possible. | public void | setCanForeignKey(boolean fkable) The user can mark columns as explicitly not having a foreign key. | public void | setCanIndex(boolean indexable) The user can mark columns as explicitly non-indexable. | public void | setCanUnique(boolean uniquable) The user can mark columns as explicitly not having a unique constraint. | public void | setColumnIO(ColumnIO io) I/O for the columns created by the last call to
MappingInfo.createColumns ,
or for the foreign key created by the last call to
MappingInfo.createForeignKey . | public void | setColumns(List cols) Raw column data. | public void | setForeignKey(ForeignKey fk) Raw foreign key information. | public void | setIndex(Index idx) Raw index. | public void | setJoinDirection(int join) Direction of the join that the columns of this mapping info form. | public void | setStrategy(String strategy) Mapping strategy name. | public void | setUnique(Unique unq) Raw unique constraint information. | protected static Column | syncColumn(MetaDataContext context, Column col, int num, boolean forceJDBCType, Table colTable, Table targetTable, Object target, boolean inverse) Create a copy of the given column with the raw mapping information
set correctly, and without settings that match defaults. | protected void | syncColumns(MetaDataContext context, Column[] cols, boolean forceJDBCType) Sets internal column information to match the given mapped columns. | protected void | syncForeignKey(MetaDataContext context, ForeignKey fk, Table local, Table target) Sets internal constraint and column information to match given mapped
constraint. | protected void | syncIndex(MetaDataContext context, Index idx) Sets internal index information to match given mapped index. | protected void | syncUnique(MetaDataContext context, Unique unq) Sets internal constraint information to match given mapped constraint. |
JOIN_FORWARD | final public static int JOIN_FORWARD(Code) | | |
JOIN_INVERSE | final public static int JOIN_INVERSE(Code) | | |
JOIN_NONE | final public static int JOIN_NONE(Code) | | |
assertNoForeignKey | public void assertNoForeignKey(MetaDataContext context, boolean die)(Code) | | Assert that the user did not try to place a foreign key on this mapping.
|
assertNoIndex | public void assertNoIndex(MetaDataContext context, boolean die)(Code) | | Assert that the user did not try to place an index on this mapping.
|
assertNoJoin | public void assertNoJoin(MetaDataContext context, boolean die)(Code) | | Assert that the user did not try to join.
|
assertNoSchemaComponents | public void assertNoSchemaComponents(MetaDataContext context, boolean die)(Code) | | Assert that the user did not supply any columns, index, unique
constraint, or foreign key for this mapping.
|
assertNoUnique | public void assertNoUnique(MetaDataContext context, boolean die)(Code) | | Assert that the user did not try to place a unique constraint on this
mapping.
|
assertStrategy | public void assertStrategy(MetaDataContext context, Object contextStrat, Object expected, boolean die)(Code) | | Assert that this info has the given strategy or no strategy.
|
canForeignKey | public boolean canForeignKey()(Code) | | The user can mark columns as explicitly not having a foreign key.
|
canIndex | public boolean canIndex()(Code) | | The user can mark columns as explicitly non-indexable.
|
canUnique | public boolean canUnique()(Code) | | The user can mark columns as explicitly not having a unique constraint.
|
clear | public void clear()(Code) | | Clear all mapping information.
|
clear | protected void clear(boolean canFlags)(Code) | | Clear mapping information.
Parameters: canFlags - whether to clear information about whether wecan place indexed, foreign keys, etc on this mapping |
copy | public void copy(MappingInfo info)(Code) | | Copy missing info from the instance to this one.
|
createColumns | protected Column[] createColumns(MetaDataContext context, String prefix, Column[] tmplates, Table table, boolean adapt)(Code) | | Retrieve/create columns on the given table by merging the given
template information with any user-provided information.
Parameters: context - the mapping we're retrieving columns for Parameters: prefix - localized error message key prefix Parameters: tmplates - template columns Parameters: table - the table for the columns Parameters: adapt - whether we can modify the existing mapping or schema |
createForeignKey | protected ForeignKey createForeignKey(MetaDataContext context, String prefix, List given, ForeignKeyDefaults def, Table table, ClassMapping cls, ClassMapping rel, boolean inversable, boolean adapt)(Code) | | Retrieve/create a foreign key (possibly logical) on the given columns
by merging the given template information with any user-provided
information.
Parameters: context - the mapping we're retrieving a key for Parameters: prefix - localized error message key prefix Parameters: given - the columns given by the user Parameters: def - defaults provider Parameters: table - the table for the key Parameters: cls - type we're joining from Parameters: rel - target type we're joining to Parameters: inversable - whether the foreign key can be inversed Parameters: adapt - whether we can modify the existing mapping or schema |
createIndex | protected Index createIndex(MetaDataContext context, String prefix, Index tmplate, Column[] cols, boolean adapt)(Code) | | Retrieve/create an index on the given columns by merging the given
template information with any user-provided information.
Parameters: context - the mapping we're retrieving an index for Parameters: prefix - localized error message key prefix Parameters: tmplate - template for expected index information Parameters: cols - the indexed columns Parameters: adapt - whether we can modify the existing mapping or schema |
createTable | public Table createTable(MetaDataContext context, TableDefaults def, String schemaName, String given, boolean adapt)(Code) | | Find or generate a table for a mapping.
Parameters: context - the mapping that uses the table Parameters: def - default table name provider Parameters: schemaName - default schema if known, or null Parameters: given - given table name Parameters: adapt - whether we can alter the schema or mappings |
createUnique | protected Unique createUnique(MetaDataContext context, String prefix, Unique tmplate, Column[] cols, boolean adapt)(Code) | | Retrieve/create a unique constraint on the given columns by merging the
given template information with any user-provided information.
Parameters: context - the mapping we're retrieving a constraint for Parameters: prefix - localized error message key prefix Parameters: tmplate - template for expected unique information Parameters: cols - the constraint columns Parameters: adapt - whether we can modify the existing mapping or schema |
getColumns | public List getColumns()(Code) | | Raw column data.
|
getForeignKey | public ForeignKey getForeignKey()(Code) | | Raw foreign key information.
|
getJoinDirection | public int getJoinDirection()(Code) | | Direction of the join that the columns of this mapping info form. This
is usually automatically set by
MappingInfo.createForeignKey . This flag
is also expected to be set correctly prior to calls to
MappingInfo.syncForeignKey if the join is inversed.
|
getStrategy | public String getStrategy()(Code) | | Mapping strategy name.
|
getUnique | public Unique getUnique()(Code) | | Raw unique constraint information.
|
hasSchemaComponents | public boolean hasSchemaComponents()(Code) | | Return true if this info has columns, foreign key information, index
information, etc.
|
mergeColumn | protected static Column mergeColumn(MetaDataContext context, String prefix, Column tmplate, boolean compat, Column given, Table table, boolean adapt, boolean fill)(Code) | | Merge the given columns if possible.
Parameters: context - the mapping we're retrieving columns for Parameters: prefix - localized error message key prefix Parameters: tmplate - template for expected column information Parameters: compat - whether the existing column type must be compatiblewith the type of the template column Parameters: given - the given column information from mapping info Parameters: table - the table for the columns Parameters: adapt - whether we can modify the existing mapping or schema Parameters: fill - whether to default missing column information |
setCanForeignKey | public void setCanForeignKey(boolean fkable)(Code) | | The user can mark columns as explicitly not having a foreign key.
|
setCanIndex | public void setCanIndex(boolean indexable)(Code) | | The user can mark columns as explicitly non-indexable.
|
setCanUnique | public void setCanUnique(boolean uniquable)(Code) | | The user can mark columns as explicitly not having a unique constraint.
|
setColumns | public void setColumns(List cols)(Code) | | Raw column data.
|
setForeignKey | public void setForeignKey(ForeignKey fk)(Code) | | Raw foreign key information.
|
setIndex | public void setIndex(Index idx)(Code) | | Raw index.
|
setJoinDirection | public void setJoinDirection(int join)(Code) | | Direction of the join that the columns of this mapping info form. This
is usually automatically set by
MappingInfo.createForeignKey . This flag
is also expected to be set correctly prior to calls to
MappingInfo.syncForeignKey if the join is inversed.
|
setStrategy | public void setStrategy(String strategy)(Code) | | Mapping strategy name.
|
setUnique | public void setUnique(Unique unq)(Code) | | Raw unique constraint information.
|
syncColumn | protected static Column syncColumn(MetaDataContext context, Column col, int num, boolean forceJDBCType, Table colTable, Table targetTable, Object target, boolean inverse)(Code) | | Create a copy of the given column with the raw mapping information
set correctly, and without settings that match defaults.
Parameters: num - the number of columns for this mapping Parameters: forceJDBCType - whether the jdbc-type of the created columnshould be set, even if it matches the defaultfor the given column's java type Parameters: colTable - expected table for the column Parameters: targetTable - expected target table for join column Parameters: target - target column or object for join column; for aconstant null target, use MappingInfo.NULL Parameters: inverse - whether join column is for inverse join |
syncColumns | protected void syncColumns(MetaDataContext context, Column[] cols, boolean forceJDBCType)(Code) | | Sets internal column information to match the given mapped columns.
Parameters: forceJDBCType - whether to force the jdbc-type of the columnsto be set, even when it matches the default for the columns' java type |
syncForeignKey | protected void syncForeignKey(MetaDataContext context, ForeignKey fk, Table local, Table target)(Code) | | Sets internal constraint and column information to match given mapped
constraint.
Parameters: local - default local table Parameters: target - default target table |
syncIndex | protected void syncIndex(MetaDataContext context, Index idx)(Code) | | Sets internal index information to match given mapped index.
|
syncUnique | protected void syncUnique(MetaDataContext context, Unique unq)(Code) | | Sets internal constraint information to match given mapped constraint.
|
|
|