java.lang.Object
org.eclipse.persistence.tools.schemaframework.FieldDefinition
- All Implemented Interfaces:
Serializable,Cloneable
Purpose: Define a database field definition for creation within a table. This differs from DatabaseField in that it is used only table creation not a runtime.
Responsibilities:
- Store the name, java type, size and sub-size. The sizes are optional and the name of the java class is used for the type.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classPurpose: Define a database-platform-specific definition for a platform independent Java class type. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected org.eclipse.persistence.internal.helper.DatabaseFieldDatabaseField stores the field name with case and delimiting information.protected Stringprotected booleanprotected booleanprotected booleanprotected Stringprotected booleanprotected intprotected intprotected Class<?> Java type class for the field.protected StringDatabase-specific complete type definition like "VARCHAR2(50) UNIQUE NOT NULL".protected StringGeneric database type name for the field, which can be used instead of the Java class 'type'. -
Constructor Summary
ConstructorsConstructorDescriptionFieldDefinition(String name, Class<?> type) FieldDefinition(String name, Class<?> type, int size) FieldDefinition(String name, Class<?> type, int size, int subSize) FieldDefinition(String name, String typeName) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendDBString(Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session, TableDefinition table) Deprecated, for removal: This API element is subject to removal in a future version.voidappendTypeString(Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session) Deprecated, for removal: This API element is subject to removal in a future version.clone()Return any additional information about this field to be given when the table is created.Return any constraint of this field.org.eclipse.persistence.internal.helper.DatabaseFieldDeprecated, for removal: This API element is subject to removal in a future version.getName()Return the name of the field.intgetSize()Return the size of the field, this is only required for some field types.intReturn the sub-size of the field.Class<?> getType()Return the type of the field.Return the type definition of the field.Return the type name of the field.booleanAnswer whether the receiver is an identity field.booleanAnswer whether the receiver is a primary key.booleanisUnique()Answer whether the receiver is a unique constraint field.voidsetAdditional(String string) Set any additional information about this field to be given when the table is created.voidsetComment(String comment) voidsetConstraint(String string) Set any constraint of this field.voidsetDatabaseField(org.eclipse.persistence.internal.helper.DatabaseField field) Deprecated, for removal: This API element is subject to removal in a future version.voidsetForeignKeyFieldName(String foreignKeyFieldName) voidsetIsIdentity(boolean value) Set whether the receiver is an identity field.voidsetIsPrimaryKey(boolean value) Set whether the receiver is a primary key.voidSet the name of the field.voidsetShouldAllowNull(boolean value) Set whether the receiver should allow null values.voidsetSize(int size) Set the size of the field, this is only required for some field types.voidsetSubSize(int subSize) Set the sub-size of the field.voidSet the type of the field.voidsetTypeDefinition(String typeDefinition) Set the type definition of the field.voidsetTypeName(String typeName) Set the type name of the field.voidsetUnique(boolean value) Set whether the receiver is a unique constraint field.booleanReturn whether the receiver should allow null values.toString()
-
Field Details
-
name
-
type
Java type class for the field. Particular database type is generated based on platform from this. -
typeName
Generic database type name for the field, which can be used instead of the Java class 'type'. This is translated to a particular database type based on platform. -
field
protected org.eclipse.persistence.internal.helper.DatabaseField fieldDatabaseField stores the field name with case and delimiting information. Used if the field needs to be found in the table metadata, for extending tables. if null, name is used for comparison to determine if this field already exists. -
typeDefinition
Database-specific complete type definition like "VARCHAR2(50) UNIQUE NOT NULL". If this is given, other additional type constraint fields(size, unique, null) are meaningless. -
size
protected int size -
subSize
protected int subSize -
shouldAllowNull
protected boolean shouldAllowNull -
isIdentity
protected boolean isIdentity -
isPrimaryKey
protected boolean isPrimaryKey -
isUnique
protected boolean isUnique -
additional
-
constraint
-
foreignKeyFieldName
-
comment
-
-
Constructor Details
-
FieldDefinition
public FieldDefinition() -
FieldDefinition
-
FieldDefinition
-
FieldDefinition
-
FieldDefinition
-
-
Method Details
-
appendDBString
@Deprecated(forRemoval=true, since="4.0.9") public void appendDBString(Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session, TableDefinition table) throws ValidationException Deprecated, for removal: This API element is subject to removal in a future version.INTERNAL: Append the database field definition string to the table creation statement.- Parameters:
writer- Target writer where to write field definition string.session- Current session context.table- Database table being processed.- Throws:
ValidationException- When invalid or inconsistent data were found.
-
appendTypeString
@Deprecated(forRemoval=true, since="4.0.9") public void appendTypeString(Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session) throws ValidationException Deprecated, for removal: This API element is subject to removal in a future version.INTERNAL: Append the database field definition string to the type creation statement. Types do not support constraints.- Parameters:
writer- Target writer where to write field definition string.session- Current session context.- Throws:
ValidationException- When invalid or inconsistent data were found.
-
clone
-
getAdditional
Return any additional information about this field to be given when the table is created. -
getComment
-
getConstraint
Return any constraint of this field. i.e. "BETWEEN 0 AND 1000000". -
getForeignKeyFieldName
-
getName
Return the name of the field. -
getDatabaseField
@Deprecated(forRemoval=true, since="4.0.9") public org.eclipse.persistence.internal.helper.DatabaseField getDatabaseField()Deprecated, for removal: This API element is subject to removal in a future version.INTERNAL: Return the DatabaseField. -
getSize
public int getSize()Return the size of the field, this is only required for some field types. -
getSubSize
public int getSubSize()Return the sub-size of the field. This is used as the decimal precision for numeric values only. -
getType
Return the type of the field. This should be set to a java class, such as String.class, Integer.class or Date.class. -
getTypeName
Return the type name of the field. This is the generic database type name, which can be used instead of the Java class 'type'. This is translated to a particular database type based on platform. -
getTypeDefinition
Return the type definition of the field. This is database-specific complete type definition like "VARCHAR2(50) UNIQUE NOT NULL". If this is given, other additional type constraint fields(size, unique, null) are meaningless. -
isIdentity
public boolean isIdentity()Answer whether the receiver is an identity field. Identity fields are Sybase specific, they ensure that on insert a unique sequential value is stored in the row. -
isPrimaryKey
public boolean isPrimaryKey()Answer whether the receiver is a primary key. If the table has a multipart primary key this should be set in each field. -
isUnique
public boolean isUnique()Answer whether the receiver is a unique constraint field. -
setAdditional
Set any additional information about this field to be given when the table is created. -
setComment
-
setConstraint
Set any constraint of this field. i.e. "BETWEEN 0 AND 1000000". -
setForeignKeyFieldName
-
setIsIdentity
public void setIsIdentity(boolean value) Set whether the receiver is an identity field. Identity fields are Sybase specific, they ensure that on insert a unique sequential value is stored in the row. -
setIsPrimaryKey
public void setIsPrimaryKey(boolean value) Set whether the receiver is a primary key. If the table has a multipart primary key this should be set in each field. -
setName
Set the name of the field. -
setDatabaseField
@Deprecated(forRemoval=true, since="4.0.9") public void setDatabaseField(org.eclipse.persistence.internal.helper.DatabaseField field) Deprecated, for removal: This API element is subject to removal in a future version.INTERNAL: Set the DatabaseField that is associated to this FieldDefinition object. The DatabaseField is used when extending tables to see if this field already exists. -
setShouldAllowNull
public void setShouldAllowNull(boolean value) Set whether the receiver should allow null values. -
setSize
public void setSize(int size) Set the size of the field, this is only required for some field types. -
setSubSize
public void setSubSize(int subSize) Set the sub-size of the field. This is used as the decimal precision for numeric values only. -
setType
Set the type of the field. This should be set to a java class, such as String.class, Integer.class or Date.class. -
setTypeName
Set the type name of the field. This is the generic database type name, which can be used instead of the Java class 'type'. This is translated to a particular database type based on platform. -
setTypeDefinition
Set the type definition of the field. This is database-specific complete type definition like "VARCHAR2(50) UNIQUE NOT NULL". If this is given, other additional type constraint fields(size, unique, null) are meaningless. -
setUnique
public void setUnique(boolean value) Set whether the receiver is a unique constraint field. -
shouldAllowNull
public boolean shouldAllowNull()Return whether the receiver should allow null values. -
toString
-