Package org.apache.openjpa.jdbc.meta
Class ClassMappingInfo
- java.lang.Object
-
- org.apache.openjpa.jdbc.meta.MappingInfo
-
- org.apache.openjpa.jdbc.meta.ClassMappingInfo
-
- All Implemented Interfaces:
java.io.Serializable,SourceTracker,Commentable
public class ClassMappingInfo extends MappingInfo implements SourceTracker, Commentable
Information about the mapping from a class to the schema, in raw form. The columns and tables used in mapping info will not be part of theSchemaGroupused at runtime. Rather, they will be structs with the relevant pieces of information filled in.- Author:
- Abe White
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.openjpa.jdbc.meta.MappingInfo
MappingInfo.ForeignKeyDefaults, MappingInfo.TableDefaults
-
-
Field Summary
-
Fields inherited from class org.apache.openjpa.jdbc.meta.MappingInfo
JOIN_FORWARD, JOIN_INVERSE, JOIN_NONE
-
Fields inherited from interface org.apache.openjpa.lib.xml.Commentable
EMPTY_COMMENTS
-
Fields inherited from interface org.apache.openjpa.lib.meta.SourceTracker
SRC_ANNOTATIONS, SRC_OTHER, SRC_XML
-
-
Constructor Summary
Constructors Constructor Description ClassMappingInfo()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddIndex(DBIdentifier table, Index idx)Add index for the given table.voidaddSecondaryTable(java.lang.String second)Deprecated.voidaddSecondaryTable(DBIdentifier second)voidaddUnique(java.lang.String table, Unique unique)Deprecated.voidaddUnique(DBIdentifier table, Unique unique)Add a unique constraint for the given table.protected voidclear(boolean canFlags)Clear mapping information.voidcopy(MappingInfo info)Copy missing info from the instance to this one.java.lang.StringgetClassName()The described class name.intgetColNumber()Return the column number in the line of the file at which this instance was parsed.java.lang.String[]getComments()Return comments, or empty array if none.Column[]getDataStoreIdColumns(ClassMapping cls, Column[] tmplates, Table table, boolean adapt)Return the datastore identity columns for the given class, based on the given templates.java.lang.StringgetHierarchyStrategy()The default strategy for subclasses in this hierarchy.Index[]getIndices(MetaDataContext cm, boolean adapt)Get all indices associated with both the primary and/or secondary tables.intgetLineNumber()Return the line number of the file at which this instance was parsed.java.lang.StringgetResourceName()Return the domain-meaningful name of the resource that was loaded from this source.DBIdentifiergetSchemaIdentifier()java.lang.StringgetSchemaName()Deprecated.DBIdentifiergetSecondaryTableIdentifier(DBIdentifier tableName)DBIdentifier[]getSecondaryTableIdentifiers()java.util.List<Column>getSecondaryTableJoinColumns(java.lang.String tableName)Deprecated.java.util.List<Column>getSecondaryTableJoinColumns(DBIdentifier tableName)java.lang.StringgetSecondaryTableName(java.lang.String tableName)Deprecated.java.lang.String[]getSecondaryTableNames()Deprecated.java.io.FilegetSourceFile()Return the file from which this instance was parsed.java.lang.ObjectgetSourceScope()Return the domain-dependent scope of this instance within its file.intgetSourceType()Return the type of source.ForeignKeygetSuperclassJoin(ClassMapping cls, Table table, boolean adapt)Return the join from this class to its superclass.TablegetTable(ClassMapping cls, boolean adapt)Return the primary table for the given class.TablegetTable(ClassMapping cls, java.lang.String tableName, boolean adapt)Deprecated.TablegetTable(ClassMapping cls, DBIdentifier tableName, boolean adapt)Return the named table for the given class.DBIdentifiergetTableIdentifier()java.lang.StringgetTableName()Deprecated.Unique[]getUniques(java.lang.String table)Deprecated.Unique[]getUniques(DBIdentifier table)Get the unique constraints of the given primary or secondary table.Unique[]getUniques(MetaDataContext cm, boolean adapt)Get all the unique constraints associated with both the primary and/or secondary tables.booleanhasSchemaComponents()Return true if this info has columns, foreign key information, index information, etc.booleanisJoinedSubclass()Whether there is a join to the superclass table.voidsetClassName(java.lang.String name)The described class name.voidsetColNumber(int colNum)voidsetComments(java.lang.String[] comments)Set comments.voidsetHierarchyStrategy(java.lang.String strategy)The default strategy for subclasses in this hierarchy.voidsetJoinedSubclass(boolean joined)Whether there is a join to the superclass table.voidsetLineNumber(int lineNum)voidsetSchemaIdentifier(DBIdentifier schema)voidsetSchemaName(java.lang.String schema)Deprecated.voidsetSecondaryTableJoinColumns(java.lang.String tableName, java.util.List<Column> cols)Deprecated.voidsetSecondaryTableJoinColumns(DBIdentifier tableName, java.util.List<Column> cols)voidsetSource(java.io.File file, int srcType)voidsetTableIdentifier(DBIdentifier table)voidsetTableName(java.lang.String table)Deprecated.voidsyncWith(ClassMapping cls)Synchronize internal information with the mapping data for the given class.-
Methods inherited from class org.apache.openjpa.jdbc.meta.MappingInfo
assertNoForeignKey, assertNoIndex, assertNoJoin, assertNoSchemaComponents, assertNoUnique, assertStrategy, canForeignKey, canIndex, canUnique, clear, createColumns, createForeignKey, createIndex, createTable, createTable, createUnique, getColumnIO, getColumns, getColumns, getColumns, getForeignKey, getIndex, getJoinDirection, getStrategy, getUnique, isImplicitRelation, mergeColumn, setCanForeignKey, setCanIndex, setCanUnique, setColumnIO, setColumns, setForeignKey, setImplicitRelation, setIndex, setJoinDirection, setStrategy, setUnique, syncColumn, syncColumns, syncForeignKey, syncIndex, syncUnique
-
-
-
-
Method Detail
-
getClassName
public java.lang.String getClassName()
The described class name.
-
setClassName
public void setClassName(java.lang.String name)
The described class name.
-
getHierarchyStrategy
public java.lang.String getHierarchyStrategy()
The default strategy for subclasses in this hierarchy.
-
setHierarchyStrategy
public void setHierarchyStrategy(java.lang.String strategy)
The default strategy for subclasses in this hierarchy.
-
getTableName
@Deprecated public java.lang.String getTableName()
Deprecated.The given table name.
-
getTableIdentifier
public DBIdentifier getTableIdentifier()
-
setTableName
@Deprecated public void setTableName(java.lang.String table)
Deprecated.The given table name.
-
setTableIdentifier
public void setTableIdentifier(DBIdentifier table)
-
getSchemaName
@Deprecated public java.lang.String getSchemaName()
Deprecated.The default schema name for unqualified tables.
-
getSchemaIdentifier
public DBIdentifier getSchemaIdentifier()
-
setSchemaName
@Deprecated public void setSchemaName(java.lang.String schema)
Deprecated.The default schema name for unqualified tables.
-
setSchemaIdentifier
public void setSchemaIdentifier(DBIdentifier schema)
-
isJoinedSubclass
public boolean isJoinedSubclass()
Whether there is a join to the superclass table.
-
setJoinedSubclass
public void setJoinedSubclass(boolean joined)
Whether there is a join to the superclass table.
-
getSecondaryTableNames
@Deprecated public java.lang.String[] getSecondaryTableNames()
Deprecated.Return the class-level joined tables.
-
getSecondaryTableIdentifiers
public DBIdentifier[] getSecondaryTableIdentifiers()
-
getSecondaryTableName
@Deprecated public java.lang.String getSecondaryTableName(java.lang.String tableName)
Deprecated.We allow fields to reference class-level joins using just the table name, whereas the class join might have schema, etc information. This method returns the name of the given table as listed in a class-level join, or the given name if no join exists.
-
getSecondaryTableIdentifier
public DBIdentifier getSecondaryTableIdentifier(DBIdentifier tableName)
-
getSecondaryTableJoinColumns
@Deprecated public java.util.List<Column> getSecondaryTableJoinColumns(java.lang.String tableName)
Deprecated.Return any columns defined for the given class level join, or empty list if none.
-
getSecondaryTableJoinColumns
public java.util.List<Column> getSecondaryTableJoinColumns(DBIdentifier tableName)
-
addSecondaryTable
@Deprecated public void addSecondaryTable(java.lang.String second)
Deprecated.Adds a Secondary table of given name to this mapping. A secondary table must be known before unique constraints are added to a Secondary table.
-
addSecondaryTable
public void addSecondaryTable(DBIdentifier second)
-
setSecondaryTableJoinColumns
@Deprecated public void setSecondaryTableJoinColumns(java.lang.String tableName, java.util.List<Column> cols)Deprecated.Declare the given class-level join to the named (secondary) table.
-
setSecondaryTableJoinColumns
public void setSecondaryTableJoinColumns(DBIdentifier tableName, java.util.List<Column> cols)
-
getTable
@Deprecated public Table getTable(ClassMapping cls, java.lang.String tableName, boolean adapt)
Deprecated.Return the named table for the given class.
-
getTable
public Table getTable(ClassMapping cls, DBIdentifier tableName, boolean adapt)
Return the named table for the given class.
-
getTable
public Table getTable(ClassMapping cls, boolean adapt)
Return the primary table for the given class.
-
getDataStoreIdColumns
public Column[] getDataStoreIdColumns(ClassMapping cls, Column[] tmplates, Table table, boolean adapt)
Return the datastore identity columns for the given class, based on the given templates.
-
getSuperclassJoin
public ForeignKey getSuperclassJoin(ClassMapping cls, Table table, boolean adapt)
Return the join from this class to its superclass. The table for this class must be set.
-
syncWith
public void syncWith(ClassMapping cls)
Synchronize internal information with the mapping data for the given class.
-
hasSchemaComponents
public boolean hasSchemaComponents()
Description copied from class:MappingInfoReturn true if this info has columns, foreign key information, index information, etc.- Overrides:
hasSchemaComponentsin classMappingInfo
-
clear
protected void clear(boolean canFlags)
Description copied from class:MappingInfoClear mapping information.- Overrides:
clearin classMappingInfo- Parameters:
canFlags- whether to clear information about whether we can place indexed, foreign keys, etc on this mapping
-
copy
public void copy(MappingInfo info)
Description copied from class:MappingInfoCopy missing info from the instance to this one.- Overrides:
copyin classMappingInfo
-
addUnique
@Deprecated public void addUnique(java.lang.String table, Unique unique)Deprecated.Add a unique constraint for the given table.- Parameters:
table- must be primary table or secondary table name added a priori to this receiver.unique- the unique constraint. null means no-op.
-
addUnique
public void addUnique(DBIdentifier table, Unique unique)
Add a unique constraint for the given table.- Parameters:
table- must be primary table or secondary table name added a priori to this receiver.unique- the unique constraint. null means no-op.
-
addIndex
public void addIndex(DBIdentifier table, Index idx)
Add index for the given table.- Parameters:
table- must be primary table or secondary table name added a priori to this receiver.idx- the index. null means no-op.
-
getUniques
@Deprecated public Unique[] getUniques(java.lang.String table)
Deprecated.Get the unique constraints of the given primary or secondary table.
-
getUniques
public Unique[] getUniques(DBIdentifier table)
Get the unique constraints of the given primary or secondary table.
-
getUniques
public Unique[] getUniques(MetaDataContext cm, boolean adapt)
Get all the unique constraints associated with both the primary and/or secondary tables.
-
getIndices
public Index[] getIndices(MetaDataContext cm, boolean adapt)
Get all indices associated with both the primary and/or secondary tables.
-
getSourceFile
public java.io.File getSourceFile()
Description copied from interface:SourceTrackerReturn the file from which this instance was parsed.- Specified by:
getSourceFilein interfaceSourceTracker
-
getSourceScope
public java.lang.Object getSourceScope()
Description copied from interface:SourceTrackerReturn the domain-dependent scope of this instance within its file.- Specified by:
getSourceScopein interfaceSourceTracker
-
getSourceType
public int getSourceType()
Description copied from interface:SourceTrackerReturn the type of source.- Specified by:
getSourceTypein interfaceSourceTracker
-
setSource
public void setSource(java.io.File file, int srcType)
-
getResourceName
public java.lang.String getResourceName()
Description copied from interface:SourceTrackerReturn the domain-meaningful name of the resource that was loaded from this source. I.e., if we had loaded the source for a Java class, this would return the name of the class.- Specified by:
getResourceNamein interfaceSourceTracker
-
getComments
public java.lang.String[] getComments()
Description copied from interface:CommentableReturn comments, or empty array if none.- Specified by:
getCommentsin interfaceCommentable
-
setComments
public void setComments(java.lang.String[] comments)
Description copied from interface:CommentableSet comments.- Specified by:
setCommentsin interfaceCommentable
-
getLineNumber
public int getLineNumber()
Description copied from interface:SourceTrackerReturn the line number of the file at which this instance was parsed.- Specified by:
getLineNumberin interfaceSourceTracker
-
setLineNumber
public void setLineNumber(int lineNum)
-
getColNumber
public int getColNumber()
Description copied from interface:SourceTrackerReturn the column number in the line of the file at which this instance was parsed.- Specified by:
getColNumberin interfaceSourceTracker
-
setColNumber
public void setColNumber(int colNum)
-
-