org.datanucleus.store.mapped
Class ColumnCreator

java.lang.Object
  extended by org.datanucleus.store.mapped.ColumnCreator

public final class ColumnCreator
extends java.lang.Object

Helper class to create columns. Used for generating columns for join table fields.


Field Summary
protected static Localiser LOCALISER
          Localiser for messages.
 
Method Summary
static JavaTypeMapping createColumnsForField(java.lang.Class javaType, JavaTypeMapping mapping, DatastoreContainerObject table, MappedStoreManager storeMgr, AbstractMemberMetaData mmd, boolean isPrimaryKey, boolean isNullable, boolean serialised, boolean embedded, int fieldRole, ColumnMetaData[] columnMetaData, ClassLoaderResolver clr, boolean isReferenceField)
          Method to create the column(s) for a field in either a join table or for a reference field.
static JavaTypeMapping createColumnsForJoinTables(java.lang.Class javaType, AbstractMemberMetaData mmd, ColumnMetaData[] columnMetaData, MappedStoreManager storeMgr, DatastoreContainerObject table, boolean primaryKey, boolean nullable, int fieldRole, ClassLoaderResolver clr)
          Method to create the mapping for a join table for collection element, array element, map key, map value.
static DatastoreField createIndexColumn(JavaTypeMapping mapping, MappedStoreManager storeMgr, ClassLoaderResolver clr, DatastoreContainerObject table, ColumnMetaData colmd, boolean pk)
          Convenience method to add the column for an index mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.

Method Detail

createIndexColumn

public static DatastoreField createIndexColumn(JavaTypeMapping mapping,
                                               MappedStoreManager storeMgr,
                                               ClassLoaderResolver clr,
                                               DatastoreContainerObject table,
                                               ColumnMetaData colmd,
                                               boolean pk)
Convenience method to add the column for an index mapping.

Parameters:
mapping - The mapping
storeMgr - Manager for the store
clr - ClassLoaderResolver
table - Table where we create the column
colmd - The column MetaData
pk - Whether this column is (part of) the PK.
Returns:
The added column

createColumnsForJoinTables

public static JavaTypeMapping createColumnsForJoinTables(java.lang.Class javaType,
                                                         AbstractMemberMetaData mmd,
                                                         ColumnMetaData[] columnMetaData,
                                                         MappedStoreManager storeMgr,
                                                         DatastoreContainerObject table,
                                                         boolean primaryKey,
                                                         boolean nullable,
                                                         int fieldRole,
                                                         ClassLoaderResolver clr)
Method to create the mapping for a join table for collection element, array element, map key, map value. Supports non-embedded, non-serialised, and must be PC.

Parameters:
javaType - The java type of the field
mmd - Metadata for the field/property
columnMetaData - MetaData defining the columns
storeMgr - Store Manager
table - The table to add the mapping to
primaryKey - Whether this field is the PK
nullable - Whether this field is to be nullable
fieldRole - The role of the mapping within this field
clr - ClassLoader resolver
Returns:
The java type mapping for this field

createColumnsForField

public static JavaTypeMapping createColumnsForField(java.lang.Class javaType,
                                                    JavaTypeMapping mapping,
                                                    DatastoreContainerObject table,
                                                    MappedStoreManager storeMgr,
                                                    AbstractMemberMetaData mmd,
                                                    boolean isPrimaryKey,
                                                    boolean isNullable,
                                                    boolean serialised,
                                                    boolean embedded,
                                                    int fieldRole,
                                                    ColumnMetaData[] columnMetaData,
                                                    ClassLoaderResolver clr,
                                                    boolean isReferenceField)
Method to create the column(s) for a field in either a join table or for a reference field.

Parameters:
javaType - The java type of the field being stored
mapping - The JavaTypeMapping (if existing, otherwise created and returned by this method)
table - The table to insert the columns into (join table, or primary table (if ref field))
storeMgr - Manager for the store
mmd - MetaData for the field (or null if a collection field)
isPrimaryKey - Whether to create the columns as part of the PK
isNullable - Whether the columns should be nullable
serialised - Whether the field is serialised
embedded - Whether the field is embedded
fieldRole - The role of the field (when part of a join table)
columnMetaData - MetaData for the column(s)
clr - ClassLoader resolver
isReferenceField - Whether this field is part of a reference field
Returns:
The JavaTypeMapping for the table


Copyright © 2010. All Rights Reserved.