org.datanucleus.store.mapped
Interface DatastoreField


public interface DatastoreField

Representation of a Java field (component) in a datastore. In the case of RDBMS this will be a column. In the case of a file-based structure this may be a file.


Method Summary
 java.lang.String applySelectFunction(java.lang.String replacementValue)
          Wraps the column name with a FUNCTION.
 void copyConfigurationTo(DatastoreField col)
          Copy the configuration of this field to another field
 ColumnMetaData getColumnMetaData()
          Access the metadata definition defining this DatastoreField.
 DatastoreContainerObject getDatastoreContainerObject()
          Accessor for the DatastoreContainerObject container of this field
 DatastoreMapping getDatastoreMapping()
          Accessor for the datastore mapping that this datastore field relates to.
 java.lang.Object getDefaultValue()
          Accessor for the default Value
 DatastoreIdentifier getIdentifier()
          Accessor for the identifier for this object.
 JavaTypeMapping getJavaTypeMapping()
          Accessor for the JavaTypeMapping for the field/property that owns this column.
 AbstractMemberMetaData getMemberMetaData()
          Accessor for the MetaData of the field/property that this is the datastore field for.
 java.lang.String getStoredJavaType()
          Accessor for the type of data stored in this field.
 MappedStoreManager getStoreManager()
          Accessor for the StoreManager for this table.
 boolean isDefaultable()
          Accessor for whether the column is defaultable.
 boolean isIdentity()
          Accessor for the whether this column is an identity column.
 boolean isNullable()
          Accessor for whether the field is nullable in the datastore.
 boolean isPrimaryKey()
          Accessor for whether the field is the primary key in the datastore.
 boolean isUnique()
          Accessor for whether the column is unique.
 void setAsPrimaryKey()
          Mutator to make the field the primary key.
 void setColumnMetaData(ColumnMetaData md)
          Method to set the MetaData for this datastore field.
 void setDatastoreMapping(DatastoreMapping mapping)
          Method to associate this datastore field with its mapping.
 DatastoreField setDefaultable()
          Mutator for the defaultability of the datastore field.
 void setDefaultValue(java.lang.Object object)
          Mutator for the default Value
 void setIdentifier(DatastoreIdentifier identifier)
          Mutator for the identifier of the column.
 DatastoreField setIdentity(boolean identity)
          Mutator for whether we set this column as an identity column.
 DatastoreField setNullable()
          Mutator for the nullability of the datastore field.
 DatastoreField setUnique()
          Mutator for the uniqueness of the column.
 

Method Detail

getStoreManager

MappedStoreManager getStoreManager()
Accessor for the StoreManager for this table.

Returns:
The StoreManager.

getStoredJavaType

java.lang.String getStoredJavaType()
Accessor for the type of data stored in this field.

Returns:
The type of data in the field.

setIdentifier

void setIdentifier(DatastoreIdentifier identifier)
Mutator for the identifier of the column.

Parameters:
identifier - The identifier

getIdentifier

DatastoreIdentifier getIdentifier()
Accessor for the identifier for this object.

Returns:
The identifier.

setAsPrimaryKey

void setAsPrimaryKey()
Mutator to make the field the primary key.


isPrimaryKey

boolean isPrimaryKey()
Accessor for whether the field is the primary key in the datastore.

Returns:
whether the field is (part of) the primary key

setNullable

DatastoreField setNullable()
Mutator for the nullability of the datastore field.

Returns:
The datastore field with the updated info

isNullable

boolean isNullable()
Accessor for whether the field is nullable in the datastore.

Returns:
whether the field is nullable

setDefaultable

DatastoreField setDefaultable()
Mutator for the defaultability of the datastore field.

Returns:
The datastore field with the updated info

isDefaultable

boolean isDefaultable()
Accessor for whether the column is defaultable.

Returns:
whether the column is defaultable

setUnique

DatastoreField setUnique()
Mutator for the uniqueness of the column.

Returns:
The datastore field with the updated info

isUnique

boolean isUnique()
Accessor for whether the column is unique.

Returns:
whether the column is unique

setIdentity

DatastoreField setIdentity(boolean identity)
Mutator for whether we set this column as an identity column. An "identity" column is typically treated differently in the datastore being given a value by the datastore itself. In RDBMS this would mean that the column is "AUTO_INCREMENT", "SERIAL" or

Parameters:
identity - True if column is identity

isIdentity

boolean isIdentity()
Accessor for the whether this column is an identity column.

Returns:
true if column is identity.

setDefaultValue

void setDefaultValue(java.lang.Object object)
Mutator for the default Value

Parameters:
object - default value

getDefaultValue

java.lang.Object getDefaultValue()
Accessor for the default Value

Returns:
the default value

setDatastoreMapping

void setDatastoreMapping(DatastoreMapping mapping)
Method to associate this datastore field with its mapping.

Parameters:
mapping - The mapping for this datastore field

getDatastoreMapping

DatastoreMapping getDatastoreMapping()
Accessor for the datastore mapping that this datastore field relates to.

Returns:
The datastore mapping

setColumnMetaData

void setColumnMetaData(ColumnMetaData md)
Method to set the MetaData for this datastore field. Should only be called before completion of initialisation.

Parameters:
md - The MetaData

getColumnMetaData

ColumnMetaData getColumnMetaData()
Access the metadata definition defining this DatastoreField.

Returns:
the MetaData

getJavaTypeMapping

JavaTypeMapping getJavaTypeMapping()
Accessor for the JavaTypeMapping for the field/property that owns this column.

Returns:
The JavaTypeMapping

getDatastoreContainerObject

DatastoreContainerObject getDatastoreContainerObject()
Accessor for the DatastoreContainerObject container of this field

Returns:
The DatastoreContainerObject

applySelectFunction

java.lang.String applySelectFunction(java.lang.String replacementValue)
Wraps the column name with a FUNCTION.
example: SQRT(?) generates: SQRT(columnName)

Parameters:
replacementValue - the replacement to ?. Probably it's a column name, that may be fully qualified name or not
Returns:
a String with function taking as parameter the replacementValue

copyConfigurationTo

void copyConfigurationTo(DatastoreField col)
Copy the configuration of this field to another field

Parameters:
col - the datastore field

getMemberMetaData

AbstractMemberMetaData getMemberMetaData()
Accessor for the MetaData of the field/property that this is the datastore field for.

Returns:
MetaData of the field/property (if representing a field/property of a class).


Copyright © 2010. All Rights Reserved.