org.datanucleus.metadata
Class ColumnMetaData

java.lang.Object
  extended by org.datanucleus.metadata.MetaData
      extended by org.datanucleus.metadata.ColumnMetaData
All Implemented Interfaces:
java.io.Serializable

public class ColumnMetaData
extends MetaData

Representation of the Meta-Data for a column mapping of a field. JDO metadata represented is :-

 <!ELEMENT column (extension*)?>
 <!ATTLIST column name CDATA #IMPLIED>
 <!ATTLIST column target CDATA #IMPLIED>
 <!ATTLIST column target-field CDATA #IMPLIED>
 <!ATTLIST column jdbc-type CDATA #IMPLIED>
 <!ATTLIST column sql-type CDATA #IMPLIED>
 <!ATTLIST column length CDATA #IMPLIED>
 <!ATTLIST column scale CDATA #IMPLIED>
 <!ATTLIST column allows-null CDATA #IMPLIED>
 <!ATTLIST column default-value CDATA #IMPLIED>
 <!ATTLIST column insert-value CDATA #IMPLIED>
 

Since:
1.1
Version:
$Revision: 1.20 $
See Also:
Serialized Form

Field Summary
protected  java.lang.Boolean allowsNull
          allows-null tag value.
protected  java.lang.String defaultValue
          column default value (when constructing the table with this column).
protected  boolean insertable
          Whether this column is to be inserted when the owning object is inserted.
protected  java.lang.String insertValue
          value to use when inserting this column in the datastore (the column is not mapped to a field/property)
protected  java.lang.String jdbcType
          jdbc-type to use (if any).
protected  java.lang.Integer length
          length to use (if any).
protected  java.lang.String name
          column name.
protected  java.lang.Integer scale
          scale to use (if any).
protected  java.lang.String sqlType
          sql-type to use (if any).
protected  java.lang.String target
          target column name.
protected  java.lang.String targetMember
          target field/property name.
protected  boolean unique
          unique tag value.
protected  boolean updateable
          Whether this column can be updated when the owning object is updated.
 
Fields inherited from class org.datanucleus.metadata.MetaData
extensions, LOCALISER, METADATA_CREATED_STATE, METADATA_INITIALISED_STATE, METADATA_POPULATED_STATE, METADATA_USED_STATE, metaDataState, parent, VENDOR_NAME, VENDOR_NAME_OLD
 
Constructor Summary
ColumnMetaData(MetaData parent, ColumnMetaData colmd)
          Creates a ColumnMetaData by copying contents from colmd.
ColumnMetaData(MetaData parent, java.lang.String name)
          Convenience constructor specifying just the column name, and the parent metadata component.
ColumnMetaData(MetaData parent, java.lang.String name, java.lang.String target, java.lang.String targetMember, java.lang.String jdbcType, java.lang.String sqlType, java.lang.String length, java.lang.String scale, java.lang.String allowsNull, java.lang.String defaultValue, java.lang.String insertValue, java.lang.String insertable, java.lang.String updateable, java.lang.String unique)
          Constructor.
 
Method Summary
 java.lang.String getDefaultValue()
          Accessor for the default value
 boolean getInsertable()
          Accessor for whether this column can be inserted when the owning object is inserted.
 java.lang.String getInsertValue()
          Accessor for the insert value
 java.lang.String getJdbcType()
          Accessor for the jdbc-type tag value
 java.lang.Integer getLength()
          Accessor for the length tag value.
 java.lang.String getName()
          Accessor for the name
 java.lang.Integer getScale()
          Accessor for the scale tag value
 java.lang.String getSqlType()
          Accessor for the sql-type tag value
 java.lang.String getTarget()
          Accessor for the column that is the target of this column in the referenced table.
 java.lang.String getTargetMember()
          Accessor for the field/property that is the target of this column in the referenced class.
 boolean getUnique()
          Accessor for the unique tag value
 boolean getUpdateable()
          Accessor for whether this column can be update when the owning object is updated.
 boolean isAllowsNull()
          Accessor for the nulls-allowed tag value
 boolean isAllowsNullSet()
          Accessor for whether the nulls allowed flag has been set.
 void setAllowsNull(java.lang.Boolean allowsNull)
          Mutator for whether nulls are allowed.
 void setJdbcType(java.lang.String jdbcType)
          Mutator for the JDBC type
 void setLength(int length)
          Mutator for the length.
 void setLength(java.lang.Integer length)
          Mutator for the length.
 void setName(java.lang.String name)
          Mutator for the name
 void setScale(int scale)
          Mutator for the scale
 void setScale(java.lang.Integer scale)
          Mutator for the scale
 void setSqlType(java.lang.String sqlType)
          Mutator for the SQL type
 java.lang.String toString(java.lang.String prefix, java.lang.String indent)
          Returns a string representation of the object using a prefix
 
Methods inherited from class org.datanucleus.metadata.MetaData
addExtension, addExtension, getExtensions, getNoOfExtensions, getParent, getValueForExtension, getValuesForExtension, hasExtension, initialise, isInitialised, isPopulated, isUsed, removeExtension, setInitialised, setParent, setPopulated, setUsed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
column name.


target

protected java.lang.String target
target column name.


targetMember

protected java.lang.String targetMember
target field/property name.


jdbcType

protected java.lang.String jdbcType
jdbc-type to use (if any).


sqlType

protected java.lang.String sqlType
sql-type to use (if any).


length

protected java.lang.Integer length
length to use (if any). Also known as precision


scale

protected java.lang.Integer scale
scale to use (if any).


allowsNull

protected java.lang.Boolean allowsNull
allows-null tag value.


defaultValue

protected java.lang.String defaultValue
column default value (when constructing the table with this column).


insertValue

protected java.lang.String insertValue
value to use when inserting this column in the datastore (the column is not mapped to a field/property)


insertable

protected boolean insertable
Whether this column is to be inserted when the owning object is inserted. JPA 1.0 attribute.


updateable

protected boolean updateable
Whether this column can be updated when the owning object is updated. JPA 1.0 attribute.


unique

protected boolean unique
unique tag value. JPA 1.0 attribute.

Constructor Detail

ColumnMetaData

public ColumnMetaData(MetaData parent,
                      ColumnMetaData colmd)
Creates a ColumnMetaData by copying contents from colmd.

Parameters:
parent - Parent MetaData component
colmd - MetaData for the column

ColumnMetaData

public ColumnMetaData(MetaData parent,
                      java.lang.String name)
Convenience constructor specifying just the column name, and the parent metadata component. Assigns nulls to other parameters.

Parameters:
parent - Parent MetaData component
name - Name of the column

ColumnMetaData

public ColumnMetaData(MetaData parent,
                      java.lang.String name,
                      java.lang.String target,
                      java.lang.String targetMember,
                      java.lang.String jdbcType,
                      java.lang.String sqlType,
                      java.lang.String length,
                      java.lang.String scale,
                      java.lang.String allowsNull,
                      java.lang.String defaultValue,
                      java.lang.String insertValue,
                      java.lang.String insertable,
                      java.lang.String updateable,
                      java.lang.String unique)
Constructor.

Parameters:
parent - parent MetaData instance
name - field name
target - target
targetMember - target field/property
jdbcType - JDBC Type to use
sqlType - SQL Type to use
length - length of field
scale - scale of field
allowsNull - Whether nulls are allowed
defaultValue - The default value for the column
insertValue - The insert value for the column
insertable - Whether this column is insertable
updateable - Whether this column is updateable
unique - Whether this column is unique
Method Detail

getName

public java.lang.String getName()
Accessor for the name

Returns:
name

getTarget

public java.lang.String getTarget()
Accessor for the column that is the target of this column in the referenced table.

Returns:
target tag value

getTargetMember

public java.lang.String getTargetMember()
Accessor for the field/property that is the target of this column in the referenced class.

Returns:
field/property that is the target

getJdbcType

public java.lang.String getJdbcType()
Accessor for the jdbc-type tag value

Returns:
jdbc-type tag value

getSqlType

public java.lang.String getSqlType()
Accessor for the sql-type tag value

Returns:
sql-type tag value

getLength

public java.lang.Integer getLength()
Accessor for the length tag value. Also known as precision

Returns:
length tag value

getScale

public java.lang.Integer getScale()
Accessor for the scale tag value

Returns:
scale tag value

isAllowsNullSet

public boolean isAllowsNullSet()
Accessor for whether the nulls allowed flag has been set.

Returns:
Whether it was set.

isAllowsNull

public boolean isAllowsNull()
Accessor for the nulls-allowed tag value

Returns:
nulls-allowed tag value

getDefaultValue

public java.lang.String getDefaultValue()
Accessor for the default value

Returns:
default value

getInsertValue

public java.lang.String getInsertValue()
Accessor for the insert value

Returns:
insert value

getInsertable

public boolean getInsertable()
Accessor for whether this column can be inserted when the owning object is inserted.

Returns:
Whether it can be inserted.

getUpdateable

public boolean getUpdateable()
Accessor for whether this column can be update when the owning object is updated.

Returns:
Whether it can be updated.

getUnique

public boolean getUnique()
Accessor for the unique tag value

Returns:
unique tag value

setScale

public final void setScale(java.lang.Integer scale)
Mutator for the scale

Parameters:
scale - The scale to set.

setScale

public final void setScale(int scale)
Mutator for the scale

Parameters:
scale - The scale to set.

setJdbcType

public final void setJdbcType(java.lang.String jdbcType)
Mutator for the JDBC type

Parameters:
jdbcType - The jdbcType to set.

setLength

public final void setLength(java.lang.Integer length)
Mutator for the length. Also known as precision

Parameters:
length - The length to set.

setLength

public final void setLength(int length)
Mutator for the length. Also known as precision

Parameters:
length - The length to set.

setName

public final void setName(java.lang.String name)
Mutator for the name

Parameters:
name - The name to set.

setAllowsNull

public final void setAllowsNull(java.lang.Boolean allowsNull)
Mutator for whether nulls are allowed.

Parameters:
allowsNull - The allowsNull to set.

setSqlType

public final void setSqlType(java.lang.String sqlType)
Mutator for the SQL type

Parameters:
sqlType - The sqlType to set.

toString

public java.lang.String toString(java.lang.String prefix,
                                 java.lang.String indent)
Returns a string representation of the object using a prefix

Overrides:
toString in class MetaData
Parameters:
prefix - prefix string
indent - indent string
Returns:
a string representation of the object.


Copyright © 2009. All Rights Reserved.