Class RDBMSTableInfo
- java.lang.Object
-
- org.datanucleus.store.rdbms.schema.RDBMSTableInfo
-
- All Implemented Interfaces:
org.datanucleus.store.schema.ListStoreSchemaData,org.datanucleus.store.schema.StoreSchemaData
public class RDBMSTableInfo extends java.lang.Object implements org.datanucleus.store.schema.ListStoreSchemaDataRepresentation of table column information in the datastore. Columns are stored as List-based, but also in a lookup Map keyed by the column name. Supports the properties :-- table_key : unique key under which this table is known (fully-qualified name)
- table_cat : catalog for this table (or null if not defined/supported)
- table_sch : schema for this table (or null if not defined/supported)
- table_name : name of the table
- time : time at which the information was provided
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Map<java.lang.String,org.datanucleus.store.schema.StoreSchemaData>columnMapByColumnNameMap of column information keyed by the column name.(package private) java.util.List<org.datanucleus.store.schema.StoreSchemaData>columnsColumn information for this table.private inthashHashcode.(package private) java.util.Map<java.lang.String,java.lang.Object>propertiesProperties of the table.
-
Constructor Summary
Constructors Constructor Description RDBMSTableInfo()RDBMSTableInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table)Constructor taking just the catalog, schema and table name directly.RDBMSTableInfo(java.sql.ResultSet rs)Constructor to create a table info definition for the current row of the passed ResultSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(org.datanucleus.store.schema.StoreSchemaData child)Method to add another column to the table schema.voidaddProperty(java.lang.String name, java.lang.Object value)Method to add a property for the table.voidclearChildren()Method to remove all children.booleanequals(java.lang.Object obj)Indicates whether some object is "equal to" this one.org.datanucleus.store.schema.StoreSchemaDatagetChild(int position)Accessor for the column at the position.org.datanucleus.store.schema.StoreSchemaDatagetChild(java.lang.String key)Accessor for the column with a particular name.java.util.List<org.datanucleus.store.schema.StoreSchemaData>getChildren()Accessor for the columnsintgetNumberOfChildren()Accessor for the number of columns in the schema for this table.org.datanucleus.store.schema.StoreSchemaDatagetParent()java.lang.ObjectgetProperty(java.lang.String name)Accessor for a property of the table.inthashCode()Returns a hash code value for this object.voidsetParent(org.datanucleus.store.schema.StoreSchemaData parent)java.lang.StringtoString()Returns the string representation of this object.
-
-
-
Field Detail
-
hash
private int hash
Hashcode. Set on first use.
-
properties
java.util.Map<java.lang.String,java.lang.Object> properties
Properties of the table.
-
columns
java.util.List<org.datanucleus.store.schema.StoreSchemaData> columns
Column information for this table.
-
columnMapByColumnName
java.util.Map<java.lang.String,org.datanucleus.store.schema.StoreSchemaData> columnMapByColumnName
Map of column information keyed by the column name.
-
-
Constructor Detail
-
RDBMSTableInfo
public RDBMSTableInfo()
-
RDBMSTableInfo
public RDBMSTableInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table)Constructor taking just the catalog, schema and table name directly.- Parameters:
catalog- Catalog containing the tableschema- Schema containing the tabletable- The table name
-
RDBMSTableInfo
public RDBMSTableInfo(java.sql.ResultSet rs)
Constructor to create a table info definition for the current row of the passed ResultSet.- Parameters:
rs- ResultSet (from DatabaseMetaData.getTables() for example).- Throws:
org.datanucleus.exceptions.NucleusDataStoreException- Thrown if an error occurs getting the information
-
-
Method Detail
-
addChild
public void addChild(org.datanucleus.store.schema.StoreSchemaData child)
Method to add another column to the table schema.- Specified by:
addChildin interfaceorg.datanucleus.store.schema.ListStoreSchemaData- Parameters:
child- Column
-
clearChildren
public void clearChildren()
Method to remove all children.- Specified by:
clearChildrenin interfaceorg.datanucleus.store.schema.ListStoreSchemaData
-
getChild
public org.datanucleus.store.schema.StoreSchemaData getChild(int position)
Accessor for the column at the position.- Specified by:
getChildin interfaceorg.datanucleus.store.schema.ListStoreSchemaData- Parameters:
position- Index of the column- Returns:
- Column at the position
-
getChild
public org.datanucleus.store.schema.StoreSchemaData getChild(java.lang.String key)
Accessor for the column with a particular name.- Parameters:
key- Name of the column- Returns:
- Column information
-
getChildren
public java.util.List<org.datanucleus.store.schema.StoreSchemaData> getChildren()
Accessor for the columns- Specified by:
getChildrenin interfaceorg.datanucleus.store.schema.ListStoreSchemaData- Returns:
- Column schema information
-
getNumberOfChildren
public int getNumberOfChildren()
Accessor for the number of columns in the schema for this table.- Specified by:
getNumberOfChildrenin interfaceorg.datanucleus.store.schema.ListStoreSchemaData- Returns:
- Number of cols
-
addProperty
public void addProperty(java.lang.String name, java.lang.Object value)Method to add a property for the table.- Specified by:
addPropertyin interfaceorg.datanucleus.store.schema.StoreSchemaData- Parameters:
name- Name of propertyvalue- Its value
-
getProperty
public java.lang.Object getProperty(java.lang.String name)
Accessor for a property of the table.- Specified by:
getPropertyin interfaceorg.datanucleus.store.schema.StoreSchemaData- Parameters:
name- Name of the property- Returns:
- Its value, or null if not defined
-
getParent
public org.datanucleus.store.schema.StoreSchemaData getParent()
- Specified by:
getParentin interfaceorg.datanucleus.store.schema.ListStoreSchemaData
-
setParent
public void setParent(org.datanucleus.store.schema.StoreSchemaData parent)
- Specified by:
setParentin interfaceorg.datanucleus.store.schema.ListStoreSchemaData
-
equals
public final boolean equals(java.lang.Object obj)
Indicates whether some object is "equal to" this one. Two RDBMSTableInfo are considered equal if their catalog, schema, table are all equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the reference object with which to compare- Returns:
- true if this object is equal to the obj argument; false otherwise.
-
hashCode
public final int hashCode()
Returns a hash code value for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hash code
-
toString
public java.lang.String toString()
Returns the string representation of this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of this object.
-
-